See file /usr/local/deploy/mvc-deploys/mvc-release/src/controllers/shows/ShowsCastController.php


+ Error on line 248

        foreach ($seasons as $s) {

<?php

namespace cbs\app\digital\controllers\shows;

use 
cbs\core\blocks\components\CastGridView;
use 
cbs\core\utils\FileUtil;
use 
cbs\core\utils\Input;
use 
cbs\core\lib\Page;
use 
cbs\core\managers\CastManager;
use 
cbs\core\controllers\shows\ShowsComponentsControllerTrait;
use 
cbs\core\blocks\components\Carousel;
use 
cbs\core\models\carousel\CastModel;
use 
cbs\core\models\show\CastDetailsModel;
use 
cbs\core\models\grid\CastGridModel;
use 
cbs\core\blocks\atoms\DropdownFilter;
use 
cbs\core\blocks\atoms\TextSizesSwitcher;
use 
cbs\app\digital\models\TemplateVars;
use 
stdClass;
use 
cbs\core\utils\ViewHelper;


class 
ShowsCastController extends \cbs\core\controllers\shows\ShowsController
{

    private 
$seasons null;
    private 
$currentSeason null;
    protected 
$filter;
    private 
$cast_type_filters = array('cast''host''crew''hosts_judges''experts''acts');
    private 
$cast_type_filter null;

    use 
ShowsComponentsControllerTrait;

    public function 
cast()
    {
        
Page::dw('BIO');
        
Page::section('Cast');
        
Page::metaTags($this->show->title ' Cast: ' $this->getCastTitle(), $this->show->title ', ' $this->getCastTitle(), $this->getCastTitle(). ': ' $this->show->title);

        
$this->view->setJSBundle('show/cast.js');
        
$this->view->setCSSBundle('pages/cast.css');
        
$this->pageVars->slug $this->configName;
        
$this->__buildCastGrid();


        
$this->view->render('pages/shows/cast/main-page');

    }

    
/**
     * setting up cast grid view
     */
    
protected function __buildCastGrid()
    {

        
$castModel $this->__buildCastModel();

        
$castGridBlock = new CastGridView($castModel->data$this->getCastTitle());
        
$castGridBlock->setAARegion('cast');
        
$castGridBlock->setTotal(count($castModel->data))
            ->
setShowSlug($this->params['slug'])
            ->
setNoDataMessage('Cast list is not available.')
            ->
setId('cast-grid');

        if (
$castModel->data[0]->season 1) {
            
$castGridBlock->setFilter($this->getSeasonFilterBlock());
        }

        
$this->pageVars->castGrid $castGridBlock;
    }


    protected function 
__buildCastModel()
    {

        
$gridModel = new CastGridModel();
        
$gridModel->setSlug($this->configName);
        
$gridModel->setData($this->getCastData());

        return 
$gridModel;
    }

    protected function 
getCastTitle()
    {
        if (
$this->show->id == '44810') {
            
$castTitle 'Hosts';
        } else if (
$this->show->id == '61456442') {
            if (
strpos(Input::getRequestURI(), 'hosts-judges') > 0) {
                
$castTitle 'Host And Judges';
            } elseif (
strpos(Input::getRequestURI(), 'acts') > 0) {
                
$castTitle 'Acts';
            }
        } else {
            
$castTitle 'Cast';
        }
        return 
$castTitle;
    }

    protected function 
setCastFilter()
    {
        if (!empty(
$this->params['cast_type_filter'])) {
            
$this->params['cast_type_filter'] = str_replace('-''_'$this->params['cast_type_filter']);
            
/** Check that the filter is legitimate otherwise go to root of show **/
            
if (!in_array($this->params['cast_type_filter'], $this->cast_type_filters)) {
                
header("Location: /shows/" $this->configName "/");
                exit;
            }
            
$this->cast_type_filter $this->params['cast_type_filter'];
        }
    }


    public function 
castDetail()
    {

        
Page::dw('BIO');
        
Page::section('Cast');
        
$this->view->setJSBundle('show/cast_detail.js');
        
$this->view->setCSSBundle('pages/cast_detail.css');

        
$castD $this->getCastDetail();
        if(
$castD->data[0]->bioType != 'host'){
            
$this->params['cast_type_filter'] = $castD->data[0]->bioType;
        }

        
# image for og tag.. if image is available
        
$og_cast_image '';
        if (isset(
$castD->data[0]->filepath) === true && $castD->data[0]->filepath != '') {
            
$og_cast_image FileUtil::cmsImage$castD->data[0]->filepath'w136');
        }

        
Page::metaTags($this->show->title ' Cast: ' .  $castD->data[0]->title $this->show->title ', ' $castD->data[0]->title$castD->data[0]->title': ' $this->show->title);
        
Page::ogTags($this->show->title ' Cast: ' $castD->data[0]->title$this->show->title ', ' $castD->data[0]->title$og_cast_image'actor'''Page::url());

        
$backPath substr(Input::getRequestURI(), 0strpos(Input::getRequestURI(), '/cast/') + 6);

        
$backBioTypeslug '';
        if (
$castD->data[0]->bioType == 'hosts_judges') {
            
$backBioTypeslug 'hosts-judges/';
        } else if (
$castD->data[0]->bioType == 'acts') {
            
$backBioTypeslug 'acts/';
        }
        
$backPath $backPath $backBioTypeslug;

        if (
$castD->data[0]->season && (count($this->show->available_video_seasons)>1)) {
            
$backPath $backPath 'season/' $castD->data[0]->season '/';
        }

        
$this->currentSeason $castD->data[0]->season;

        
$this->pageVars->backPath $backPath;
        
$this->pageVars->castDetail $castD->data;
        
$this->pageVars->slug $this->configName;


        
$castBlock = new Carousel();
        
$castBlock->setId('js-cast')
            ->
addClasses(['cast__wrapper'])
            ->
setItems($this->getCarouselCast())
            ->
setAARegion('cast')
            ->
setOrientation(Carousel::ORIENTATION_PORTRAIT);

        
$this->pageVars->cast $castBlock;

        
$textSizesSwitcher = new TextSizesSwitcher();
        
$textSizesSwitcher->setAARegion('cast');
        
$textSizesSwitcher->setAASubCat('detail');
        
$this->pageVars->textSizesSwitcher $textSizesSwitcher;

        
$this->view->render('pages/shows/cast/detail-page');
    }

    protected function 
getCastData($pageType 'landing')
    {

        
$this->setCastFilter();
        
$manager = new CastManager($this->showId);
        
$manager->excludeBio();
        
$manager->size 50;

        if (
$pageType == 'landing') {
            
/* Redirect for SEO get params season  */
            
if (isset($_GET['season']) && is_numeric($_GET['season']) && $_GET['season'] >= 0) {
                
header("Location: /shows/" $this->configName "/cast/season/" intval($_GET['season']));
                exit;
            }

            if (isset(
$this->params['season']) && is_numeric($this->params['season']) && $this->params['season'] >= 0) {
                
$this->currentSeason intval($this->params['season']);

                
/* Make sure the param season is not greater than the current season */
                
if ($this->currentSeason $this->show->season) {
                    
$this->currentSeason $this->show->season;
                }
                
$manager->season $this->currentSeason;
            }

            
$this->seasons $manager->getSeasons();
        } else {
            
$manager->season $this->currentSeason;
        }

        if (!empty(
$this->cast_type_filter)) {
            
$castData $manager->findAll($this->cast_type_filter);
        } else {
            
$castData $manager->findAll();

        }
        return 
$castData;
    }

    protected function 
getCarouselCast()
    {

        
$castModel = new CastModel();
        
$castModel->setSlug($this->configName);
        if (isset(
$this->params['id'])) {
            
$castModel->setCastID($this->params['id']);
        }
        
$castModel->setData($this->getCastData('detail'));
        return 
$castModel;
    }

    protected function 
getCastDetail()
    {
        
$manager = new CastManager($this->showId);
        
$castDetailData $manager->findById($this->params['id']);

        if(empty(
$castDetailData)){
            
ViewHelper::force404();
        }

        
$castDetailModel = new CastDetailsModel();
        
$castDetailModel->setData($castDetailData);
        return 
$castDetailModel;
    }

    protected function 
getSeasonFilterBlock()
    {

        
$currentSeason $this->currentSeason;
        
$seasonFilterBlock null;

        
# seasons
        
$seasons $this->seasons;

        
$seasonFilters = [];

        foreach ($seasons as $s) {

            
$seasonFilter = new stdClass();
            
$seasonFilter->title 'Season ' $s->season_number;
            
$seasonFilter->value $s->season_number;
            
array_push($seasonFilters$seasonFilter);
        }

        
$seasonFilterBlock = new DropdownFilter();
        
$seasonFilterBlock->setFilters($seasonFilters);
        
$selectedFilterInd array_search($currentSeasonarray_column($seasonFilters'value'));
        if (
$selectedFilterInd !== false) {
            
$seasonFilterBlock->setSelectedInd($selectedFilterInd);
        }

        if (!
$currentSeason) {
            
$currentSeason = !empty($this->show->season) ? $this->show->season : ($seasonFilters[0]->value ?? null);
        }

        if (
$currentSeason) {
            
$episodesPassThroughParams['seasonNum'] = $currentSeason;
        }

        return 
$seasonFilterBlock;

    }

}

* Stack Trace...

  1. /usr/local/deploy/mvc-deploys/mvc-release/htdocs/index.php(168) calling run()
  2. /usr/local/deploy/mvc-deploys/mvc-release/vendor/viacomcbs/doophp/src/app/DooWebApp.php(34) calling routeTo()
  3. /usr/local/deploy/mvc-deploys/mvc-release/vendor/viacomcbs/doophp/src/app/DooWebApp.php(127) calling cast()
  4. /usr/local/deploy/mvc-deploys/mvc-release/src/controllers/shows/ShowsCastController.php(42) calling __buildCastGrid()
  5. /usr/local/deploy/mvc-deploys/mvc-release/src/controllers/shows/ShowsCastController.php(65) calling getSeasonFilterBlock()

* Variables...  Conf .  GET  .  POST  .  Session  .  Cookie 


object(DooConfig)#11 (22) {
  
["AUTOLOAD"] => NULL
  
["SITE_PATH"] => string(42"/usr/local/deploy/mvc-deploys/mvc-release/"
  
["PROTECTED_FOLDER"] => string(46"/usr/local/deploy/mvc-deploys/mvc-release/src/"
  
["BASE_PATH"] => string(70"/usr/local/deploy/mvc-deploys/mvc-release/vendor/viacomcbs/doophp/src/"
  
["LOG_PATH"] => NULL
  
["APP_URL"] => string(24"http://test-www.cbs.com/"
  
["SUBFOLDER"] => string(1"/"
  
["APP_MODE"] => string(3"dev"
  
["AUTOROUTE"] => bool(false)
  [
"DEBUG_ENABLED"] => bool(true)
  [
"ERROR_404_DOCUMENT"] => NULL
  
["ERROR_404_ROUTE"] => string(43"/error/?%2Fshows%2Ftough-as-nails%2Fcast%2F"
  
["CACHE_PATH"] => NULL
  
["AUTO_VIEW_RENDER_PATH"] => string(17"/shows/:slug/cast"
  
["MEMCACHE"] => NULL
  
["TEMPLATE_ENGINE"] => string(7"DooView"
  
["TEMPLATE_SHOW_COMMENT"] => NULL
  
["TEMPLATE_ALLOW_PHP"] => NULL
  
["TEMPLATE_COMPILE_ALWAYS"] => NULL
  
["TEMPLATE_GLOBAL_TAGS"] => NULL
  
["MODULES"] => NULL
  
["APP_NAMESPACE_ID"] => NULL
}
$_COOKIE Variables array(0) {
}