public function behaviors() { return [['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['review_list_none' => ['reviews'], 'review_list_null' => ['reviews', 'default' => null], 'review_list_constant' => ['reviews', 'default' => 7], 'review_list_closure' => ['reviews', 'default' => function ($model, $relationName, $attributeName) { $db = Yii::$app->db; //OR //$db = $model::getDb(); //OR //$secondaryModelClass = $model->getRelation($relationName)->modelClass; //$db = $secondaryModelClass::getDb(); return $db->createCommand('SELECT value FROM settings WHERE key="default_review"')->queryScalar(); }]]]]; }
public function behaviors() { return [['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['author_list' => ['authors', 'get' => function ($value) { return JSON::encode($value); }, 'set' => function ($value) { return JSON::decode($value); }], 'review_list' => ['reviews', 'get' => function ($value) { return JSON::encode($value); }, 'set' => function ($value) { return JSON::decode($value); }]]]]; }
/** * @inheritdoc */ public function behaviors() { return [TimestampBehavior::className(), ['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['view_ids' => 'views', 'facility_ids' => 'facilities', 'stage_ids' => 'stages']]]; }
/** * @return array */ public function behaviors() { return [['class' => ManyToManyBehavior::className(), 'relations' => ['events' => 'events']], TimestampBehavior::className()]; }
public function behaviors() { return [['class' => ManyToManyBehavior::className(), 'relations' => ['accountability_list' => 'accountabilities']]]; }
public function attach($owner) { $owner->attachBehavior($this->getRelationName(), ['class' => ManyToManyBehavior::className(), 'relations' => [$this->getAttributeName() => $this->getRelationName()]]); parent::attach($owner); }
public function behaviors() { return [['class' => ManyToManyBehavior::className(), 'relations' => ['students_list' => 'students', 'students_count' => ['students', 'get' => function ($value) { return count($value); }]]]]; }
public function behaviors() { return [['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['regions_ids' => 'regions', 'offices_ids' => 'offices']]]; }
/** * See https://github.com/mongosoft/yii2-upload-behavior */ public function behaviors() { return [['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['orgs_list' => 'orgs']], ['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['specTypes_list' => 'specTypes']]]; }
public function behaviors() { return [['class' => SluggableBehavior::className(), 'attribute' => 'title', 'slugAttribute' => 'slug'], ['class' => UploadImageBehavior::className(), 'attribute' => 'image', 'scenarios' => ['default'], 'path' => '@webroot/uploads/posts/{id}', 'url' => '@web/uploads/posts/{id}', 'thumbs' => ['thumb' => ['width' => 200, 'quality' => 90]]], ['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['category_ids' => 'categories']]]; }
public function behaviors() { return [['class' => ManyToManyBehavior::className(), 'relations' => ['five_list' => 'tableFiveRecords']]]; }
public function behaviors() { return [['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['perks_list' => 'perks']]]; }
/** * @inheritdoc */ public function behaviors() { return [['class' => TimestampBehavior::className(), 'createdAtAttribute' => 'time', 'updatedAtAttribute' => false], ['class' => ManyToManyBehavior::className(), 'relations' => ['type_ids' => 'types']]]; }
public function behaviors() { return [['class' => LinkAllBehavior::className()], ['class' => ManyToManyBehavior::className(), 'relations' => ['three_list' => 'tableThreeRecords']]]; }
/** * @inheritdoc */ public function behaviors() { return [['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['users_list' => 'users', 'statuses_list' => 'orderStatuses', 'order_template' => 'orderTemplate']], ['class' => ActiveRecordHelper::className(), 'cache' => 'cache']]; }
function behaviors() { return ['field' => ['class' => 'app\\modules\\field\\behaviors\\AttachFields'], ['class' => ManyToManyBehavior::className(), 'relations' => ['user_ids' => 'users']]]; }
public function behaviors() { return [['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['author_list' => ['authors'], 'review_list' => ['reviews']]]]; }
/** @inheritdoc */ public function behaviors() { return [['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['visible_attributes' => 'visibleAttributes', 'editable_attributes' => 'editableAttributes']], ['class' => ActiveRecordHelper::className(), 'cache' => 'cache']]; }