当前位置: 首页>>代码示例>>PHP>>正文


PHP Model::__construct方法代码示例

本文整理汇总了PHP中yii\base\Model::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::__construct方法的具体用法?PHP Model::__construct怎么用?PHP Model::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\base\Model的用法示例。


在下文中一共展示了Model::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * @inheritdoc
  */
 public function __construct($config = [])
 {
     parent::__construct($config);
     if (is_null($this->columns)) {
         $this->columns = [new Column()];
     }
 }
开发者ID:blumster,项目名称:yii2-gii-migration-designer,代码行数:10,代码来源:Table.php

示例2: __construct

 public function __construct($config = [])
 {
     if ($this->getUserSecurityQusetions() != null) {
         $this->setAttributes(['question_one' => $this->getUserSecurityQusetions()->security_question_one_id, 'question_one_answer' => $this->getUserSecurityQusetions()->security_question_one_answer, 'question_two' => $this->getUserSecurityQusetions()->security_question_two_id, 'question_two_answer' => $this->getUserSecurityQusetions()->security_question_two_answer], false);
     }
     parent::__construct($config);
 }
开发者ID:buuug7,项目名称:game4039,代码行数:7,代码来源:UserSecurityQuestionsForm.php

示例3: __construct

 /**
  * CategoryForm constructor
  * @param integer|null $item_id
  */
 public function __construct($item_id = null)
 {
     parent::__construct();
     if ($item_id) {
         /** @var $category Category*/
         $category = Category::findOne($item_id);
         $this->item_id = $category->id;
         $this->language_id = $category->language_id;
         $this->title = $category->title;
         $this->description = $category->description;
         $this->category_type = $category->category_type;
         if ($category->main) {
             $this->boxes[] = self::PROPERTY_MAIN;
         }
         if ($category->public) {
             $this->boxes[] = self::PROPERTY_PUBLIC;
         }
         if ($category->active) {
             $this->boxes[] = self::PROPERTY_ACTIVE;
         }
     } else {
         $session = Yii::$app->session;
         if (!$session['language_id']) {
             $session['language_id'] = LanguageRecord::getMainLanguageId();
         }
         $this->language_id = $session['language_id'];
         $this->boxes[] = self::PROPERTY_PUBLIC;
         $this->boxes[] = self::PROPERTY_ACTIVE;
     }
 }
开发者ID:czechcamus,项目名称:dasport,代码行数:34,代码来源:CategoryForm.php

示例4: __construct

 public function __construct($user, $config = [])
 {
     parent::__construct($config);
     $this->_user = $user;
     $this->username = $user->username;
     $this->email = $user->email;
 }
开发者ID:guillemc,项目名称:yii2starter,代码行数:7,代码来源:ProfileForm.php

示例5: __construct

 /**
  * Find profession categories with professions links
  * @param array $config
  */
 public function __construct($config = [])
 {
     $this->categorias = Categorias::find()->with(['articulos' => function ($query) {
         $query->andWhere(['in', 'estado', [Articulos::NUEVO, Articulos::USADO, Articulos::OFERTA, Articulos::RESERVADO]])->orderBy(['idarticulo' => SORT_DESC]);
     }])->activas()->all();
     parent::__construct($config);
 }
开发者ID:alejandrososa,项目名称:AB,代码行数:11,代码来源:MapaSitio.php

示例6: __construct

 /**
  * @param Mailer $mailer
  * @param Finder $finder
  * @param array  $config
  */
 public function __construct(Mailer $mailer, Finder $finder, $config = [])
 {
     $this->module = \Yii::$app->getModule('user');
     $this->mailer = $mailer;
     $this->finder = $finder;
     parent::__construct($config);
 }
开发者ID:manyoubaby123,项目名称:imshop,代码行数:12,代码来源:RecoveryForm.php

示例7: __construct

 /**
  * @param integer|null $item_id
  */
 public function __construct($item_id = null)
 {
     parent::__construct();
     if ($item_id) {
         /** @var $poll PollRecord */
         $poll = PollRecord::findOne($item_id);
         $this->item_id = $poll->id;
         $this->language_id = $poll->language_id;
         $this->question = $poll->question;
         $this->end_date = $poll->end_date ? Yii::$app->formatter->asDate($poll->end_date, 'dd.MM.y') : null;
         if ($poll->active) {
             $this->boxes[] = self::PROPERTY_ACTIVE;
         }
         if ($poll->main) {
             $this->boxes[] = self::PROPERTY_MAIN;
         }
         foreach ($poll->answers as $pollAnswer) {
             $this->answers[] = $pollAnswer->answer;
         }
         $voices = PollAnswerRecord::find()->where(['poll_id' => $poll->id])->andWhere('voices>0')->count();
         $this->isAnswersEditable = !$voices;
     } else {
         $session = Yii::$app->session;
         if (!$session['language_id']) {
             $session['language_id'] = LanguageRecord::getMainLanguageId();
         }
         $this->language_id = $session['language_id'];
         $this->boxes[] = self::PROPERTY_ACTIVE;
         $this->answers[1] = $this->answers[0] = '';
         $this->isAnswersEditable = true;
     }
 }
开发者ID:czechcamus,项目名称:dasport,代码行数:35,代码来源:PollForm.php

示例8: __construct

 /**
  * @param array $config
  * @param bool $item
  */
 public function __construct($config = [], $item = false)
 {
     parent::__construct($config);
     if ($item) {
         $this->attributes = $item;
     }
 }
开发者ID:highestgoodlikewater,项目名称:Yii2-templete,代码行数:11,代码来源:EditProfile.php

示例9: __construct

 /** @inheritdoc */
 public function __construct(Mailer $mailer, $config = [])
 {
     $this->mailer = $mailer;
     $this->module = \Yii::$app->getModule('user');
     $this->setAttributes(['username' => $this->user->username, 'email' => $this->user->email, 'tagline' => $this->user->tagline, 'display_name' => $this->user->display_name], false);
     parent::__construct($config);
 }
开发者ID:sunjie20081001,项目名称:getyii,代码行数:8,代码来源:AccountForm.php

示例10: __construct

 /** @inheritdoc */
 public function __construct(Mailer $mailer, $config = [])
 {
     $this->mailer = $mailer;
     $this->module = Yii::$app->getModule('user');
     $this->setAttributes(['username' => $this->user->username, 'email' => $this->user->unconfirmed_email ?: $this->user->email], false);
     parent::__construct($config);
 }
开发者ID:ketuker,项目名称:oil-palm-cultivation-thesis,代码行数:8,代码来源:SettingsForm.php

示例11: __construct

 /**
  * Creates a form model given a token.
  *
  * @param int   $id     The user ID.
  * @param array $config name-value pairs that will be used to initialize the object properties
  * @throws \yii\base\InvalidParamException if token is empty or not valid
  */
 public function __construct($id, $config = [])
 {
     // Volunteer can be new or have an existing entry.
     $this->_volunteer = Volunteer::findOne($id);
     if (!$this->_volunteer) {
         $this->_volunteer = new Volunteer();
         $this->_volunteer->accountID = $id;
     } else {
         // Initialise form values.
         foreach ($this::$interestBits as $key => $value) {
             if ($key & $this->_volunteer->interests) {
                 $this->interests[] = $key;
             }
         }
         foreach ($this::$availabilityBits as $key => $value) {
             if ($key & $this->_volunteer->availability) {
                 $this->availability[] = $key;
             }
             if ($key & $this->_volunteer->experience) {
                 $this->experience[] = $key;
             }
         }
         $this->daysAvailable = $this->_volunteer->daysAvailable;
         $this->skills = $this->_volunteer->skills;
         $this->mobile = User::findOne($id)->details->mobile;
     }
     parent::__construct($config);
 }
开发者ID:rhamlet1,项目名称:Hazid,代码行数:35,代码来源:VolunteerForm.php

示例12: __construct

 /**
  * @inheritdoc
  */
 public function __construct(Posts $postModel, $config = [])
 {
     $this->postModel = $postModel;
     $this->setAttributes($this->postModel->getAttributes(['title', 'description', 'file', 'category_id', 'author_id', 'create_date']));
     $this->tags = ArrayHelper::map($postModel->tagPost, 'name', 'name');
     parent::__construct($config);
 }
开发者ID:sydorenkovd,项目名称:yiiadv,代码行数:10,代码来源:Postt.php

示例13: __construct

 /**
  * PageForm constructor
  * @param integer|null $item_id
  */
 public function __construct($item_id = null)
 {
     parent::__construct();
     if ($item_id) {
         /** @var $page Page */
         $page = Page::findOne($item_id);
         $this->item_id = $page->id;
         $this->language_id = $page->language_id;
         if ($page->image) {
             $this->imageFilename = $page->image->filename;
         }
         $this->perex = $page->perex;
         $this->title = $page->title;
         $this->description = $page->description;
         if ($page->active) {
             $this->boxes[] = self::PROPERTY_ACTIVE;
         }
         if ($page->public) {
             $this->boxes[] = self::PROPERTY_PUBLIC;
         }
         $this->tagValues = $page->tagValues;
     } else {
         $session = Yii::$app->session;
         if (!$session['language_id']) {
             $session['language_id'] = LanguageRecord::getMainLanguageId();
         }
         $this->language_id = $session['language_id'];
         $this->boxes[] = self::PROPERTY_ACTIVE;
         $this->boxes[] = self::PROPERTY_PUBLIC;
     }
 }
开发者ID:czechcamus,项目名称:dasport,代码行数:35,代码来源:PageForm.php

示例14: __construct

 public function __construct(ActionsRecord $model, $config = [])
 {
     $this->_model = $model;
     if ($this->objects !== false && isset($config['objects']) && is_string($config['objects'])) {
         $config['objects'] = preg_split('/,\\s*/', $config['objects']);
     }
     parent::__construct($config);
 }
开发者ID:just-leo,项目名称:cardgame-serial,代码行数:8,代码来源:DiscountAbstract.php

示例15: __construct

 /**
  * Creates a form model given a token.
  *
  * @param  array                           $config name-value pairs that will be used to initialize the object properties
  * @throws \yii\base\InvalidParamException if token is empty or not valid
  */
 public function __construct($config = [])
 {
     $this->_user = User::thisUser();
     if (!$this->_user) {
         throw new InvalidParamException('Wrong password reset token.');
     }
     parent::__construct($config);
 }
开发者ID:IVsevolod,项目名称:zouk,代码行数:14,代码来源:ChangePasswordForm.php


注:本文中的yii\base\Model::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。