コード例 #1
0
 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();
     }]]]];
 }
コード例 #2
0
 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);
     }]]]];
 }
コード例 #3
0
ファイル: Sale.php プロジェクト: dench/resistor
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return [TimestampBehavior::className(), ['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['view_ids' => 'views', 'facility_ids' => 'facilities', 'stage_ids' => 'stages']]];
 }
コード例 #4
0
 /**
  * @return array
  */
 public function behaviors()
 {
     return [['class' => ManyToManyBehavior::className(), 'relations' => ['events' => 'events']], TimestampBehavior::className()];
 }
コード例 #5
0
 public function behaviors()
 {
     return [['class' => ManyToManyBehavior::className(), 'relations' => ['accountability_list' => 'accountabilities']]];
 }
コード例 #6
0
 public function attach($owner)
 {
     $owner->attachBehavior($this->getRelationName(), ['class' => ManyToManyBehavior::className(), 'relations' => [$this->getAttributeName() => $this->getRelationName()]]);
     parent::attach($owner);
 }
コード例 #7
0
ファイル: Teacher.php プロジェクト: kmarenov/yii2-app-test
 public function behaviors()
 {
     return [['class' => ManyToManyBehavior::className(), 'relations' => ['students_list' => 'students', 'students_count' => ['students', 'get' => function ($value) {
         return count($value);
     }]]]];
 }
コード例 #8
0
ファイル: User.php プロジェクト: igribov/question-list
 public function behaviors()
 {
     return [['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['regions_ids' => 'regions', 'offices_ids' => 'offices']]];
 }
コード例 #9
0
 /**
  * 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']]];
 }
コード例 #10
0
ファイル: Post.php プロジェクト: obuhovski/my-site
 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']]];
 }
コード例 #11
0
 public function behaviors()
 {
     return [['class' => ManyToManyBehavior::className(), 'relations' => ['five_list' => 'tableFiveRecords']]];
 }
コード例 #12
0
ファイル: Worker.php プロジェクト: des1roer/yii2lesson
 public function behaviors()
 {
     return [['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['perks_list' => 'perks']]];
 }
コード例 #13
0
ファイル: Application.php プロジェクト: dench/resistor
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return [['class' => TimestampBehavior::className(), 'createdAtAttribute' => 'time', 'updatedAtAttribute' => false], ['class' => ManyToManyBehavior::className(), 'relations' => ['type_ids' => 'types']]];
 }
コード例 #14
0
ファイル: TableOne.php プロジェクト: AntoninSlejska/yii-test
 public function behaviors()
 {
     return [['class' => LinkAllBehavior::className()], ['class' => ManyToManyBehavior::className(), 'relations' => ['three_list' => 'tableThreeRecords']]];
 }
コード例 #15
0
ファイル: Store.php プロジェクト: sap55/yii2-order-management
 /**
  * @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']];
 }
コード例 #16
0
ファイル: Stock.php プロジェクト: oakcms/oakcms
 function behaviors()
 {
     return ['field' => ['class' => 'app\\modules\\field\\behaviors\\AttachFields'], ['class' => ManyToManyBehavior::className(), 'relations' => ['user_ids' => 'users']]];
 }
コード例 #17
0
 public function behaviors()
 {
     return [['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['author_list' => ['authors'], 'review_list' => ['reviews']]]];
 }
コード例 #18
0
 /** @inheritdoc */
 public function behaviors()
 {
     return [['class' => \voskobovich\behaviors\ManyToManyBehavior::className(), 'relations' => ['visible_attributes' => 'visibleAttributes', 'editable_attributes' => 'editableAttributes']], ['class' => ActiveRecordHelper::className(), 'cache' => 'cache']];
 }