Bundle/WidgetMapBundle/Warmer/ContextualViewWarmer.php
public function warm(View $viewToWarm, View $contextualView = null)
    {
        $widgetMaps = [];

        if (null === $contextualView) {
            $contextualView = $viewToWarm;
        }

        foreach ($viewToWarm->getWidgetMaps() as $_widgetMap) {
            $_widgetMap->setContextualView($contextualView);
            $widgetMaps[] = $_widgetMap;
        }

        if ($template = $viewToWarm->getTemplate()) {
            $templateWidgetMaps = $this->warm($template, $contextualView);
            $widgetMaps = array_merge($widgetMaps, $templateWidgetMaps);
        }

        return $widgetMaps;
    }
public function warm(View $viewToWarm, View $contextualView = null)
    {
        $widgetMaps = [];

        if (null === $contextualView) {
            $contextualView = $viewToWarm;
        }

        foreach ($viewToWarm->getWidgetMaps() as $_widgetMap) {
            $_widgetMap->setContextualView($contextualView);
            $widgetMaps[] = $_widgetMap;
        }

        if ($template = $viewToWarm->getTemplate()) {
            $templateWidgetMaps = $this->warm($template, $contextualView);
            $widgetMaps = array_merge($widgetMaps, $templateWidgetMaps);
        }

        return $widgetMaps;
    }
public function warm ( View $ viewToWarm , View $ contextualView = null ) { $ widgetMaps = [ ] ; if ( null === $ contextualView ) { $ contextualView = $ viewToWarm ; } foreach ( $ viewToWarm -> getWidgetMaps ( ) as $ _widgetMap ) { $ _widgetMap -> setContextualView ( $ contextualView ) ; $ widgetMaps [ ] = $ _widgetMap ; } if ( $ template = $ viewToWarm -> getTemplate ( ) ) { $ templateWidgetMaps = $ this -> warm ( $ template , $ contextualView ) ; $ widgetMaps = array_merge ( $ widgetMaps , $ templateWidgetMaps ) ; } return $ widgetMaps ; }
Give a contextual View to each WidgetMap used in a View and its Templates.

@param View      $viewToWarm
@param View|null $contextualView Used in recursive call only

@return WidgetMap[]
Give a contextual View to each WidgetMap used in a View and its Templates .