當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。