|
- <?php
-
- namespace domain\PointSale\SharedPointSale;
-
- use common\components\ActiveRecordCommon;
- use domain\PointSale\PointSale\PointSale;
- use domain\Producer\Producer\Producer;
-
- class SharedPointSale extends ActiveRecordCommon
- {
- public function getPointSale(): PointSale
- {
- return $this->pointSaleRelation;
- }
-
- public function setPointSale(PointSale $pointSale): self
- {
- $this->populateFieldObject('id_point_sale', 'pointSaleRelation', $pointSale);
- return $this;
- }
-
- public function getProducerWithSharing(): Producer
- {
- return $this->producerWithSharingRelation;
- }
-
- public function setProducerWithSharing(Producer $producerWithSharing): self
- {
- $this->populateFieldObject('id_producer_with_sharing', 'producerWithSharingRelation', $producerWithSharing);
-
- return $this;
- }
-
- public function getPointSaleWithSharing(): ?PointSale
- {
- return $this->pointSaleWithSharing;
- }
-
- public function setPointSaleWithSharing(PointSale $pointSaleWithSharing = null): self
- {
- if($pointSaleWithSharing) {
- $this->populateFieldObject('id_point_sale_with_sharing', 'pointSaleWithSharingRelation', $pointSaleWithSharing);
- }
-
- return $this;
- }
-
- public function getStatus(): int
- {
- return $this->status;
- }
-
- public function setStatus(int $status): self
- {
- $this->status = $status;
- return $this;
- }
-
- public static function tableName()
- {
- return 'shared_point_sale';
- }
-
- public function rules()
- {
- return [
- [['id_point_sale', 'id_producer_with_sharing'], 'required'],
- [['id_point_sale', 'id_producer_with_sharing', 'id_point_sale_with_sharing', 'status'], 'integer'],
- ];
- }
-
- public function attributeLabels()
- {
- return [
- 'id_point_sale' => 'Point de vente que vous souhaitez partager',
- 'id_producer_with_sharing' => 'Producteur avec qui vous souhaitez partager un point de vente',
- 'id_point_sale_with_sharing' => 'Point de vente du producteur avec qui vous souhaitez partager un point de vente',
- ];
- }
-
- /* Relations */
-
- public function getPointSaleRelation()
- {
- return $this->hasOne(PointSale::class, ['id' => 'id_point_sale']);
- }
-
- public function getProducerWithSharingRelation()
- {
- return $this->hasOne(Producer::class, ['id' => 'id_producer_with_sharing']);
- }
-
- public function getPointSaleWithSharingRelation()
- {
- return $this->hasOne(PointSale::class, ['id' => 'id_point_sale_with_sharing']);
- }
- }
|