src/Entity/XiboLayout.php
public function getById($id, $embed = '')
    {
        $this->getLogger()->info('Getting layout ID ' . $id);
        $hydratedRegions = [];
        $hydratedWidgets = [];
        $response = $this->doGet($this->url, [
            'layoutId' => $id, 'retired' => -1, 'embed' => $embed
        ]);

        if (count($response) <= 0)
            throw new XiboApiException('Expecting a single record, found ' . count($response));

        /** @var XiboLayout $layout */
        $layout = $this->hydrate($response[0]);

        foreach ($layout->regions as $item) {
            /** @var XiboRegion $region */
            $region = new XiboRegion($this->getEntityProvider());
            $region->hydrate($item);
            if (strpos($embed, 'playlists') !== false) {
                /** @var XiboPlaylist $playlist */
                $playlist = new XiboPlaylist($this->getEntityProvider());
                $playlist->hydrate($item['regionPlaylist']);
                foreach ($playlist->widgets as $widget) {
                    /** @var XiboWidget $widgetObject */
                    $widgetObject = new XiboWidget($this->getEntityProvider());
                    $widgetObject->hydrate($widget);
                    $hydratedWidgets[] = $widgetObject;
                }
                $playlist->widgets = $hydratedWidgets;
                $region->regionPlaylist = $playlist;
            }
            // Add to parent object
            $hydratedRegions[] = $region;
        }
        $layout->regions = $hydratedRegions;

        return clone $layout;
    }
public function getById($id, $embed = '')
    {
        $this->getLogger()->info('Getting layout ID ' . $id);
        $hydratedRegions = [];
        $hydratedWidgets = [];
        $response = $this->doGet($this->url, [
            'layoutId' => $id, 'retired' => -1, 'embed' => $embed
        ]);

        if (count($response) <= 0)
            throw new XiboApiException('Expecting a single record, found ' . count($response));

        /** @var XiboLayout $layout */
        $layout = $this->hydrate($response[0]);

        foreach ($layout->regions as $item) {
            /** @var XiboRegion $region */
            $region = new XiboRegion($this->getEntityProvider());
            $region->hydrate($item);
            if (strpos($embed, 'playlists') !== false) {
                /** @var XiboPlaylist $playlist */
                $playlist = new XiboPlaylist($this->getEntityProvider());
                $playlist->hydrate($item['regionPlaylist']);
                foreach ($playlist->widgets as $widget) {
                    /** @var XiboWidget $widgetObject */
                    $widgetObject = new XiboWidget($this->getEntityProvider());
                    $widgetObject->hydrate($widget);
                    $hydratedWidgets[] = $widgetObject;
                }
                $playlist->widgets = $hydratedWidgets;
                $region->regionPlaylist = $playlist;
            }
            // Add to parent object
            $hydratedRegions[] = $region;
        }
        $layout->regions = $hydratedRegions;

        return clone $layout;
    }
public function getById ( $ id , $ embed = '' ) { $ this -> getLogger ( ) -> info ( 'Getting layout ID ' . $ id ) ; $ hydratedRegions = [ ] ; $ hydratedWidgets = [ ] ; $ response = $ this -> doGet ( $ this -> url , [ 'layoutId' => $ id , 'retired' => - 1 , 'embed' => $ embed ] ) ; if ( count ( $ response ) <= 0 ) throw new XiboApiException ( 'Expecting a single record, found ' . count ( $ response ) ) ; /** @var XiboLayout $layout */ $ layout = $ this -> hydrate ( $ response [ 0 ] ) ; foreach ( $ layout -> regions as $ item ) { /** @var XiboRegion $region */ $ region = new XiboRegion ( $ this -> getEntityProvider ( ) ) ; $ region -> hydrate ( $ item ) ; if ( strpos ( $ embed , 'playlists' ) !== false ) { /** @var XiboPlaylist $playlist */ $ playlist = new XiboPlaylist ( $ this -> getEntityProvider ( ) ) ; $ playlist -> hydrate ( $ item [ 'regionPlaylist' ] ) ; foreach ( $ playlist -> widgets as $ widget ) { /** @var XiboWidget $widgetObject */ $ widgetObject = new XiboWidget ( $ this -> getEntityProvider ( ) ) ; $ widgetObject -> hydrate ( $ widget ) ; $ hydratedWidgets [ ] = $ widgetObject ; } $ playlist -> widgets = $ hydratedWidgets ; $ region -> regionPlaylist = $ playlist ; } // Add to parent object $ hydratedRegions [ ] = $ region ; } $ layout -> regions = $ hydratedRegions ; return clone $ layout ; }
Get the layout by its ID.

@param int $id LayoutId to search for
@param string $embed A comma separated list of related data tp embed such as regions, playlists, widgets, tags, etc
@return XiboLayout
@throws XiboApiException
Get the layout by its ID .