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);
     }]]]];
 }
Esempio n. 3
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return [TimestampBehavior::className(), ['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['view_ids' => 'views', 'facility_ids' => 'facilities', 'stage_ids' => 'stages']]];
 }
Esempio n. 4
0
 /**
  * @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);
 }
Esempio n. 7
0
 public function behaviors()
 {
     return [['class' => ManyToManyBehavior::className(), 'relations' => ['students_list' => 'students', 'students_count' => ['students', 'get' => function ($value) {
         return count($value);
     }]]]];
 }
Esempio n. 8
0
 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']]];
 }
Esempio n. 10
0
 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']]];
 }
Esempio n. 11
0
 public function behaviors()
 {
     return [['class' => ManyToManyBehavior::className(), 'relations' => ['five_list' => 'tableFiveRecords']]];
 }
Esempio n. 12
0
 public function behaviors()
 {
     return [['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['perks_list' => 'perks']]];
 }
Esempio n. 13
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return [['class' => TimestampBehavior::className(), 'createdAtAttribute' => 'time', 'updatedAtAttribute' => false], ['class' => ManyToManyBehavior::className(), 'relations' => ['type_ids' => 'types']]];
 }
Esempio n. 14
0
 public function behaviors()
 {
     return [['class' => LinkAllBehavior::className()], ['class' => ManyToManyBehavior::className(), 'relations' => ['three_list' => 'tableThreeRecords']]];
 }
Esempio n. 15
0
 /**
  * @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']];
 }
Esempio n. 16
0
 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']]]];
 }
Esempio n. 18
0
 /** @inheritdoc */
 public function behaviors()
 {
     return [['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['visible_attributes' => 'visibleAttributes', 'editable_attributes' => 'editableAttributes']], ['class' => ActiveRecordHelper::className(), 'cache' => 'cache']];
 }