本文整理汇总了PHP中yii\base\Behavior::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Behavior::init方法的具体用法?PHP Behavior::init怎么用?PHP Behavior::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\base\Behavior
的用法示例。
在下文中一共展示了Behavior::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
parent::init();
$this->target = Yii::createObject($this->targetClass);
if (!$this->condition) {
$this->target = $this->target->findOne($this->condition);
}
}
示例2: init
/**
* Инициализация
* @throws InvalidConfigException
*/
public function init()
{
if (empty($this->attribute)) {
throw new InvalidConfigException("Class property 'attribute' does`t set");
}
parent::init();
}
示例3: init
public function init()
{
parent::init();
if (!$this->versionTable) {
throw new Exception(\Yii::t('app', 'Version table not defined'));
}
}
示例4: init
/**
*
*/
public function init()
{
parent::init();
if (!is_array($this->columnValues) || count($this->columnValues) == 0) {
throw new \InvalidArgumentException('Нужно задать значения для вывода');
}
}
示例5: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
if (empty($this->attributes)) {
$this->attributes = [BaseActiveRecord::EVENT_AFTER_INSERT => [], BaseActiveRecord::EVENT_BEFORE_UPDATE => [], BaseActiveRecord::EVENT_BEFORE_DELETE => []];
}
}
示例6: init
/**
* Инициализация
*/
public function init()
{
if (!is_array($this->apps)) {
$this->apps = [$this->apps];
}
parent::init();
}
示例7: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
if (is_null($this->values)) {
$this->values = time();
}
}
示例8: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
if (empty($this->attributes)) {
throw new InvalidConfigException('The "attributes" property must be set.');
}
}
示例9: init
public function init()
{
parent::init();
if (!is_array($this->attributes)) {
$this->attributes = [$this->attributes];
}
}
示例10: init
public function init()
{
if (!is_array($this->counters)) {
throw new InvalidParamException('counters property should be array');
}
return parent::init();
}
示例11: init
/**
* Init
*/
public function init()
{
if ($this->attributes == null) {
throw new InvalidConfigException('Property "attributes" must be set');
}
parent::init();
}
示例12: init
/**
* Invokes init of parent class and assigns proper values to internal _fields variable
*/
public function init()
{
parent::init();
//configure _fields
foreach ($this->relations as $attributeName => $params) {
//add primary field
$this->_fields[$attributeName] = ['attribute' => $attributeName];
if (isset($params['get'])) {
$this->_fields[$attributeName]['get'] = $params['get'];
}
if (isset($params['set'])) {
$this->_fields[$attributeName]['set'] = $params['set'];
}
//add secondary fields
if (isset($params['fields'])) {
foreach ($params['fields'] as $fieldName => $params) {
$fullFieldName = $attributeName . '_' . $fieldName;
if (isset($this->_fields[$fullFieldName])) {
throw new ErrorException("Ambiguous field name definition: {$fullFieldName}");
}
$this->_fields[$fullFieldName] = ['attribute' => $attributeName];
if (isset($params['get'])) {
$this->_fields[$fullFieldName]['get'] = $params['get'];
}
if (isset($params['set'])) {
$this->_fields[$fullFieldName]['set'] = $params['set'];
}
}
}
}
}
示例13: init
public function init()
{
if (is_null($this->generators)) {
$this->generators = $this->defaultGenerators();
}
parent::init();
}
示例14: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
if ($this->related === null) {
throw new InvalidConfigException('The "related" property must be set.');
}
}
示例15: init
public function init()
{
parent::init();
if (!$this->meta) {
$this->meta = ['title' => 'title'];
}
}