protected function getSiteResources(Site $site)
    {
        $primaryDomain = $site->getDomain();

        if (empty($primaryDomain)) {
            // no resources if domain missing
            return array();
        }

        $primaryDomainName = $primaryDomain->getDomainName();
        $siteId = $site->getSiteId();

        $sitesResourceId = $this->resourceName->get(self::RESOURCE_SITES);
        $siteResourceId = $this->resourceName->get(self::RESOURCE_SITES, $siteId);

        $return[$siteResourceId] = [
            'resourceId' => $siteResourceId,
            'parentResourceId' => $sitesResourceId,
            'name' => $primaryDomainName,
            'description' => "Resource for site '{$primaryDomainName}'"
        ];

        $return[$siteResourceId] = array_merge(
            $this->resources[$sitesResourceId],
            $return[$siteResourceId]
        );

        $pagesResourceId = $this->resourceName->get(self::RESOURCE_SITES, $siteId, self::RESOURCE_PAGES);

        $return[$pagesResourceId] = [
            'resourceId' => $pagesResourceId,
            'parentResourceId' => $siteResourceId,
            'name' => $primaryDomainName . ' - pages',
            'description' => "Resource for pages on site '{$primaryDomainName}'"
        ];

        $return[$pagesResourceId] = array_merge(
            $this->resources[self::RESOURCE_PAGES],
            $return[$pagesResourceId]
        );

        $pages = $site->getPages();

        /** @var \Rcm\Entity\Page $page */
        foreach ($pages as &$page) {
            $pageResources = $this->getPageResources($page, $site);
            $return = array_merge($pageResources, $return);
        }

        return $return;
    }
protected function getSiteResources(Site $site)
    {
        $primaryDomain = $site->getDomain();

        if (empty($primaryDomain)) {
            // no resources if domain missing
            return array();
        }

        $primaryDomainName = $primaryDomain->getDomainName();
        $siteId = $site->getSiteId();

        $sitesResourceId = $this->resourceName->get(self::RESOURCE_SITES);
        $siteResourceId = $this->resourceName->get(self::RESOURCE_SITES, $siteId);

        $return[$siteResourceId] = [
            'resourceId' => $siteResourceId,
            'parentResourceId' => $sitesResourceId,
            'name' => $primaryDomainName,
            'description' => "Resource for site '{$primaryDomainName}'"
        ];

        $return[$siteResourceId] = array_merge(
            $this->resources[$sitesResourceId],
            $return[$siteResourceId]
        );

        $pagesResourceId = $this->resourceName->get(self::RESOURCE_SITES, $siteId, self::RESOURCE_PAGES);

        $return[$pagesResourceId] = [
            'resourceId' => $pagesResourceId,
            'parentResourceId' => $siteResourceId,
            'name' => $primaryDomainName . ' - pages',
            'description' => "Resource for pages on site '{$primaryDomainName}'"
        ];

        $return[$pagesResourceId] = array_merge(
            $this->resources[self::RESOURCE_PAGES],
            $return[$pagesResourceId]
        );

        $pages = $site->getPages();

        /** @var \Rcm\Entity\Page $page */
        foreach ($pages as &$page) {
            $pageResources = $this->getPageResources($page, $site);
            $return = array_merge($pageResources, $return);
        }

        return $return;
    }
protected function getSiteResources ( Site $ site ) { $ primaryDomain = $ site -> getDomain ( ) ; if ( empty ( $ primaryDomain ) ) { // no resources if domain missing return array ( ) ; } $ primaryDomainName = $ primaryDomain -> getDomainName ( ) ; $ siteId = $ site -> getSiteId ( ) ; $ sitesResourceId = $ this -> resourceName -> get ( self :: RESOURCE_SITES ) ; $ siteResourceId = $ this -> resourceName -> get ( self :: RESOURCE_SITES , $ siteId ) ; $ return [ $ siteResourceId ] = [ 'resourceId' => $ siteResourceId , 'parentResourceId' => $ sitesResourceId , 'name' => $ primaryDomainName , 'description' => "Resource for site '{$primaryDomainName}'" ] ; $ return [ $ siteResourceId ] = array_merge ( $ this -> resources [ $ sitesResourceId ] , $ return [ $ siteResourceId ] ) ; $ pagesResourceId = $ this -> resourceName -> get ( self :: RESOURCE_SITES , $ siteId , self :: RESOURCE_PAGES ) ; $ return [ $ pagesResourceId ] = [ 'resourceId' => $ pagesResourceId , 'parentResourceId' => $ siteResourceId , 'name' => $ primaryDomainName . ' - pages' , 'description' => "Resource for pages on site '{$primaryDomainName}'" ] ; $ return [ $ pagesResourceId ] = array_merge ( $ this -> resources [ self :: RESOURCE_PAGES ] , $ return [ $ pagesResourceId ] ) ; $ pages = $ site -> getPages ( ) ; /** @var \Rcm\Entity\Page $page */ foreach ( $ pages as & $ page ) { $ pageResources = $ this -> getPageResources ( $ page , $ site ) ; $ return = array_merge ( $ pageResources , $ return ) ; } return $ return ; }
Get all resources for a site

@param Site $site Rcm Site Entity

@return array
Get all resources for a site