Пример #1
0
 /**
  * @inheritdoc
  */
 public function disableContentContainer(ContentContainerActiveRecord $container)
 {
     parent::disableContentContainer($container);
     foreach (Poll::find()->contentContainer($container)->all() as $poll) {
         $poll->delete();
     }
 }
 /**
  * Returns a given poll by given request parameter.
  *
  * This method also validates access rights of the requested poll object.
  */
 private function getPollByParameter()
 {
     $pollId = (int) Yii::$app->request->get('pollId');
     $poll = Poll::find()->contentContainer($this->contentContainer)->readable()->where(['poll.id' => $pollId])->one();
     if ($poll == null) {
         throw new HttpException(401, Yii::t('PollsModule.controllers_PollController', 'Could not load poll!'));
     }
     if (!$poll->content->canRead()) {
         throw new HttpException(401, Yii::t('PollsModule.controllers_PollController', 'You have insufficient permissions to perform that operation!'));
     }
     return $poll;
 }