|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- <?php
-
-
-
- namespace common\logic\User\UserProducer\Model;
-
- use common\logic\Producer\Producer\Model\Producer;
- use common\logic\User\User\Model\User;
- 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', 'product_price_percent'], 'integer'],
- [['active', 'bookmark', 'credit_active'], 'boolean'],
- [['credit', 'product_price_percent'], 'double'],
- ];
- }
-
-
-
- public function attributeLabels()
- {
- return [
- 'id_user' => 'Utilisateur',
- 'id_producer' => 'Producteur',
- 'active' => 'Actif',
- 'bookmark' => 'Favoris',
- 'credit_active' => 'Crédit',
- 'product_price_percent' => 'Prix produits : pourcentage'
- ];
- }
-
- public function getProducer()
- {
- return $this->hasOne(Producer::class, ['id' => 'id_producer']);
- }
-
- public function populateProducer(Producer $producer): void
- {
- $this->populateFieldObject('id_producer', 'producer', $producer);
- }
-
- public function getUser()
- {
- return $this->hasOne(User::class, ['id' => 'id_user']);
- }
-
- public function populateUser(User $user): void
- {
- $this->populateFieldObject('id_user', 'user', $user);
- }
-
- public function getIdUser(): int
- {
- return $this->id_user;
- }
-
- public function setIdUser(int $idUser): self
- {
- $this->id_user = $idUser;
-
- return $this;
- }
-
- public function getIdProducer(): int
- {
- return $this->id_producer;
- }
-
- public function setIdProducer(int $idProducer): self
- {
- $this->id_producer = $idProducer;
-
- return $this;
- }
-
- public function getActive(): ?bool
- {
- return $this->active;
- }
-
- public function setActive(bool $active): self
- {
- $this->active = $active;
-
- return $this;
- }
-
- public function getBookmark(): ?bool
- {
- return $this->bookmark;
- }
-
- public function setBookmark(bool $bookmark): self
- {
- $this->bookmark = $bookmark;
-
- return $this;
- }
-
- public function getCredit(): float
- {
- return $this->credit;
- }
-
- public function setCredit(float $credit): self
- {
- $this->credit = $credit;
-
- return $this;
- }
-
- public function getCreditActive(): ?bool
- {
- return $this->credit_active;
- }
-
- public function setCreditActive(bool $creditActive): self
- {
- $this->credit_active = $creditActive;
-
- return $this;
- }
-
- public function getProductPricePercent(): float
- {
- return $this->product_price_percent;
- }
-
- public function setProductPricePercent(float $productPricePercent): self
- {
- $this->product_price_percent = $productPricePercent;
-
- return $this;
- }
- }
|