<?php namespace backend\controllers; use backend\controllers\BackendController; use domain\Feature\Feature\Feature; use yii\filters\AccessControl; class SponsorshipController extends BackendController { public function behaviors() { return [ 'access' => [ 'class' => AccessControl::class, 'rules' => [ [ 'allow' => true, 'roles' => ['@'], 'matchCallback' => function ($rule, $action) { return $this->getFeatureModule()->getChecker()->isEnabled(Feature::ALIAS_SPONSORSHIP) && $this->getUserModule() ->getAuthorizationChecker() ->isGrantedAsProducer($this->getUserCurrent()); } ], ], ], ]; } public function actionIndex() { $producerCurrent = $this->getProducerCurrent(); return $this->render('index', [ 'producer' => $producerCurrent, 'producersGodsonsArray' => $this->getProducerModule()->getRepository()->findProducersSponsorshipGodsons($producerCurrent) ]); } }