本文整理汇总了PHP中yii\base\Model::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::init方法的具体用法?PHP Model::init怎么用?PHP Model::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\base\Model
的用法示例。
在下文中一共展示了Model::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
parent::init();
$this->emails = ['test@test.com', 'test2@test.com', 'test3@test.com'];
$this->schedule = [['day' => '27.02.2015', 'user_id' => 31, 'priority' => 1, 'enable' => 1], ['day' => '27.02.2015', 'user_id' => 33, 'priority' => 2, 'enable' => 0]];
$this->questions = [['question' => 'test1', 'answers' => [['right' => 0, 'answer' => 'test1'], ['right' => 1, 'answer' => 'test2']]]];
}
示例2: init
/**
* @inheritdoc
*
* Model MUST be provided on object creation.
*
* @throws InvalidConfigException
*/
public function init()
{
parent::init();
if ($this->model === null) {
throw new InvalidConfigException('Model must be provided on object creation');
}
}
示例3: init
public function init()
{
parent::init();
foreach (Yii::$app->request->cookies->getValue('cart', []) as $item) {
$this->add($item);
}
}
示例4: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
$settingsManager = Yii::$app->settings;
$this->type = $settingsManager->get('cache.class');
$this->expireTime = $settingsManager->get('cache.expireTime');
}
示例5: init
/**
* Initialization
* Set default values
* @return void
*/
public function init()
{
parent::init();
if ($this->item !== null) {
$this->setAttributes(['name' => $this->item->name, 'description' => $this->item->description], false);
}
}
示例6: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
if (!$this->id) {
$this->id = Inflector::slug($this->label);
}
}
示例7: init
public function init()
{
parent::init();
if (is_array($this->publication)) {
$this->publication = new Publication($this->publication);
}
}
示例8: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
if (($object = $this->object) !== null) {
$this->setAttributes($object->getAttributes(['title', 'alias']), false);
}
}
示例9: init
public function init()
{
parent::init();
if (\Yii::$app->request->isAjax) {
$this->setResponseFormatJson();
}
}
示例10: init
public function init()
{
parent::init();
// Setting default values
$this->welcome_popup_title = 'Welcome';
$this->welcome_popup_content = 'Welcome content';
}
示例11: init
public function init()
{
$module = null;
Module::validateConfig($module);
$this->_settings = $module->loginSettings;
parent::init();
}
示例12: init
public function init()
{
parent::init();
$this->year = date('Y');
$this->operator = self::OPERATOR_ALL;
$this->type = self::TYPE_OVERRUN;
}
示例13: __construct
public function __construct(array $properties = array())
{
parent::init();
foreach ($properties as $key => $value) {
$this->{$key} = $value;
}
}
示例14: init
/**
*
*/
public function init()
{
parent::init();
$this->timezone = (new DateTimeZone('Europe/Kaliningrad'))->getOffset(new \DateTime()) / 60;
$this->version = \Yii::$app->version;
$this->bundle = 'com.example.app';
}
示例15: init
public function init()
{
parent::init();
$mm = \Yii::$app->mailmaster;
$this->setListID(ArrayHelper::getValue($mm, 'forms.' . $this->formReplaceID . '.listID'));
$this->setFormID(ArrayHelper::getValue($mm, 'forms.' . $this->formReplaceID . '.formID'));
}