Sulu\Component\Webspace\Manager\WebspaceCollection::toArray PHP Method

toArray() public method

Returns the content of these portals as array.
public toArray ( ) : array
return array
    public function toArray()
    {
        $collection = [];
        $webspaces = [];
        foreach ($this->webspaces as $webspace) {
            $webspaces[] = $webspace->toArray();
        }
        $portalInformations = [];
        foreach ($this->portalInformations as $environment => $environmentPortalInformations) {
            $portalInformations[$environment] = [];
            foreach ($environmentPortalInformations as $environmentPortalInformation) {
                $portalInformations[$environment][$environmentPortalInformation->getUrl()] = $environmentPortalInformation->toArray();
            }
        }
        $collection['webspaces'] = $webspaces;
        $collection['portalInformations'] = $portalInformations;
        return $collection;
    }

Usage Example

示例#1
0
 /**
  * Creates a new class with the data from the given collection.
  *
  * @param array $options
  *
  * @return string
  */
 public function dump($options = [])
 {
     return $this->render('WebspaceCollectionClass.php.twig', ['cache_class' => $options['cache_class'], 'base_class' => $options['base_class'], 'collection' => $this->webspaceCollection->toArray()]);
 }
All Usage Examples Of Sulu\Component\Webspace\Manager\WebspaceCollection::toArray