本文整理汇总了PHP中yii\db\ActiveRecord::init方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecord::init方法的具体用法?PHP ActiveRecord::init怎么用?PHP ActiveRecord::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\db\ActiveRecord
的用法示例。
在下文中一共展示了ActiveRecord::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Init function
* @defaultParam sort = 500
*/
public function init()
{
if (empty($this->sort)) {
$this->sort = 500;
}
parent::init();
}
示例2: init
public function init()
{
$this->created_at = time();
$this->is_blocked = false;
$this->parent_id = NULL;
return parent::init();
}
示例3: init
public function init()
{
parent::init();
$this->typeList = [self::PAY_IN => 'Пополнение счета', self::PAY_OUT => 'Выплата'];
$this->statusList = [self::STATUS_PENDING => 'На рассмотрении магазина', self::STATUS_FAIL => 'Не оплачен', self::STATUS_SUCCESS => 'Оплачен'];
$this->status = self::STATUS_SUCCESS;
}
示例4: init
public function init()
{
parent::init();
if (isset(Yii::$app->user) && Yii::$app->user instanceof WebUser && !Yii::$app->user->getIsGuest() && static::ADMIN == Yii::$app->user->identity->status) {
$this->scenario = 'admin';
}
}
示例5: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
$this->active = true;
$this->height = 300;
$this->imageCount = 0;
}
示例6: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
$this->on(self::EVENT_BEFORE_INSERT, function (\yii\base\ModelEvent $Event) {
$Event->sender->date_create = new \yii\db\Expression('NOW()');
});
}
示例7: init
public function init()
{
// if (!is_dir($this->previewUploadPath())){
// FileHelper::createDirectory($this->previewUploadPath(),0777);
// }
parent::init();
}
示例8: init
/** @inheritdoc */
public function init()
{
$this->finder = \Yii::$container->get(Finder::className());
$this->mailer = \Yii::$container->get(Mailer::className());
$this->module = \Yii::$app->getModule('user');
parent::init();
}
示例9: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
if (!$this->type) {
$this->type = static::TYPE;
}
}
示例10: init
public function init()
{
parent::init();
$this->_modelFields = array_keys(self::getAttributes());
self::getConfig();
XiiHeader::run(self::$_whoAmI);
}
示例11: init
public function init()
{
if (!$this->userClass) {
$this->userClass = Yii::$app->modules[Module::MODULE_ID]->userClass;
}
return parent::init();
}
示例12: init
public function init()
{
if ($this->hasAttribute('sort_num')) {
$this->sort_num = Constants::getSortNum();
}
parent::init();
}
示例13: init
/**
* @inheritdoc
*/
public function init()
{
if (null === $this->uid) {
$this->uid = self::generateUID();
}
parent::init();
}
示例14: init
public function init()
{
// create weights
$key = 0;
foreach ($this->getRuleAllIdName() as $id => $name) {
$this->weights[$key] = $key;
$key++;
}
$this->weights[$key] = $key;
$modelRuleCondition = new RuleCondition();
/*echo('<pre>');
print_r($modelRuleCondition->conditions);
print_r($modelRuleCondition->weights);
echo('</pre>');
exit();*/
$this->RuleCondition_conditions = $modelRuleCondition->conditions;
$this->RuleCondition_equations = $modelRuleCondition->equations;
$this->RuleCondition_weights = $modelRuleCondition->weights;
$this->RuleCondition_name = [];
$this->RuleCondition_condition = [];
$this->RuleCondition_equation = [];
$this->RuleCondition_value = [];
$this->RuleCondition_weight = [];
parent::init();
}
示例15: init
public function init()
{
parent::init();
$this->on(self::EVENT_AFTER_FIND, [$this, 'decodeTransactionConfig']);
$this->on(self::EVENT_BEFORE_INSERT, [$this, 'encodeTransactionConfig']);
$this->on(self::EVENT_BEFORE_UPDATE, [$this, 'encodeTransactionConfig']);
}