|
- <?php
-
-
-
- namespace domain\User\UserProducer;
-
- use common\components\ActiveRecordCommon;
- use domain\Producer\Producer\Producer;
- use domain\User\User\User;
-
-
- 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', 'newsletter'], '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 setNewsletter(bool $newsletter): self
- {
- $this->newsletter = $newsletter;
-
- 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;
- }
- }
|