App\Source\Factory\SectionFactory::getSectionWithRequest PHP Метод

getSectionWithRequest() публичный статический Метод

public static getSectionWithRequest ( Psr\Http\Message\ServerRequestInterface $req )
$req Psr\Http\Message\ServerRequestInterface
    public static function getSectionWithRequest(Request $req)
    {
        $sectionId = self::getSectionId($req->getAttribute('route')->getName());
        if ($sectionId > 0) {
            return ModelsFactory::getModel('sections')->find($sectionId);
        }
        return new \stdClass();
    }

Usage Example

Пример #1
0
 public function sectionAction(request $req, $res)
 {
     $this->data['pageData'] = SectionFactory::getSectionWithRequest($req);
     $this->setRequestResult($req, $res);
     $this->data['subSections'] = Sections::getSubSections($this->data['pageData']->id);
     $this->data['pagesLinks'] = Pages::where('category_id', $this->data['pageData']->id)->get();
     $this->render('public\\main\\pages\\section_page.twig');
 }