<?php

namespace Opentalent\OtTemplating\XClass\News;

use GeorgRinger\News\Domain\Model\Dto\NewsDemand;
use GeorgRinger\News\Utility\Page;

class NewsController extends \GeorgRinger\News\Controller\NewsController
{
    protected function createDemandObjectFromSettings(
        array $settings,
              $class = NewsDemand::class
    ): \GeorgRinger\News\Domain\Model\Dto\NewsDemand {
        $demand = parent::createDemandObjectFromSettings($settings, $class);

        $rootUid = $GLOBALS['TSFE']->site->getRootPageId();
        $demand->setStoragePage(Page::extendPidListByChildren(
            '' . $rootUid,
            5
        ));

        return $demand;
    }
}
