|
- <?php
-
-
-
- namespace common\models;
-
- use Yii;
- use common\components\ActiveRecordCommon ;
-
-
- class UserProducer extends ActiveRecordCommon
- {
-
-
-
- public static function tableName()
- {
- return 'user_producer';
- }
-
-
-
- public function rules()
- {
- return [
- [['id_user', 'id_producer'], 'required'],
- [['id_user', 'id_producer'], 'integer'],
- [['active','bookmark','credit_active'], 'boolean'],
- [['credit'], 'double'],
- ];
- }
-
-
-
- public function attributeLabels()
- {
- return [
- 'id_user' => 'Utilisateur',
- 'id_producer' => 'Producteur',
- 'active' => 'Actif',
- 'bookmark' => 'Favoris',
- 'credit_active' => 'Crédit'
- ];
- }
-
- public function getProducer()
- {
- return $this->hasOne(Producer::className(), ['id' => 'id_producer']);
- }
-
-
-
- public static function defaultOptionsSearch() {
- return [
- 'with' => [],
- 'join_with' => [],
- 'orderby' => '',
- 'attribute_id_producer' => 'user_producer.id_producer'
- ] ;
- }
-
- }
|