| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- <?php
- namespace AppBundle\Entity\Product;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\ORM\Mapping as ORM;
- use Dunglas\ApiBundle\Annotation\Iri;
- use Symfony\Component\Serializer\Annotation\Groups;
- use Symfony\Component\Validator\Constraints as Assert;
- use AppBundle\Entity\Traits\TimestampableEntity;
- use AppBundle\Entity\Traits\CreatorUpdaterEntity;
- /**
- * Prix et application d'éventuelles réductions sur un Intangible
- *
- * @Iri("http://schema.org/IntangiblePriceAndDiscount")
- */
- #[ORM\Entity]
- class IntangiblePriceAndDiscount
- {
- use TimestampableEntity;
- use CreatorUpdaterEntity;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer')]
- #[ORM\Id]
- #[ORM\GeneratedValue(strategy: 'AUTO')]
- #[Groups(['intangiblepriceanddiscount', 'educational_project_intangible_list', 'access_intangible_list', 'intangible_list'])]
- private $id;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Assert\Choice(callback: ['AppBundle\Enum\Product\IntangibleAmountTypeEnum', 'toArray'])]
- #[Groups(['intangiblepriceanddiscount', 'educational_project_intangible_list_intangiblepriceanddiscount', 'access_intangible_list_intangiblepriceanddiscount', 'intangible_list_intangiblepriceanddiscount', 'access_intangible_list_intangible'])]
- private $amountType;
- /**
- * @var bool
- */
- #[ORM\Column(type: 'boolean', options: ['default' => true])]
- #[Assert\Type(type: 'boolean')]
- #[Assert\NotNull]
- #[Groups(['intangiblepriceanddiscount', 'educational_project_intangible_list_intangiblepriceanddiscount', 'access_intangible_list_intangiblepriceanddiscount', 'intangible_list_intangiblepriceanddiscount', 'access_intangible_list_intangible'])]
- private $applyDiscount = true;
- /**
- * @var ArrayCollection<IntangibleDiscountDetail>
- */
- #[Assert\Valid]
- #[ORM\OneToMany(targetEntity: 'IntangibleDiscountDetail', mappedBy: 'intangiblePriceAndDiscount', cascade: ['persist'], orphanRemoval: true)]
- #[Groups(['intangiblepriceanddiscount_intangiblediscountdetail'])]
- private $intangibleDiscountDetails;
- /**
- * @var float
- */
- #[ORM\Column(type: 'float', nullable: true)]
- #[Assert\Type(type: 'float')]
- #[Groups(['intangiblepriceanddiscount', 'educational_project_intangible_list_intangiblepriceanddiscount', 'access_intangible_list_intangiblepriceanddiscount'])]
- private $price;
- /**
- * @var bool
- */
- #[ORM\Column(type: 'boolean', options: ['default' => true])]
- #[Assert\Type(type: 'boolean')]
- #[Assert\NotNull]
- #[Groups(['intangiblepriceanddiscount'])]
- private $automaticDiscountCalculation = true;
- /**
- * Sets id.
- *
- * @param int $id
- *
- * @return $this
- */
- public function setId($id)
- {
- $this->id = $id;
- return $this;
- }
- /**
- * Gets id.
- *
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Constructor
- */
- public function __construct()
- {
- $this->intangibleDiscountDetail = new ArrayCollection();
- }
- /**
- * Set amountType
- *
- * @param string $amountType
- *
- * @return IntangiblePriceAndDiscount
- */
- public function setAmountType($amountType)
- {
- $this->amountType = $amountType;
- return $this;
- }
- /**
- * Get amountType
- *
- * @return string
- */
- public function getAmountType()
- {
- return $this->amountType;
- }
- /**
- * Set applyDiscount
- *
- * @param boolean $applyDiscount
- *
- * @return IntangiblePriceAndDiscount
- */
- public function setApplyDiscount($applyDiscount)
- {
- $this->applyDiscount = $applyDiscount;
- return $this;
- }
- /**
- * Get applyDiscount
- *
- * @return boolean
- */
- public function getApplyDiscount()
- {
- return $this->applyDiscount;
- }
- /**
- * Set price
- *
- * @param float $price
- *
- * @return IntangiblePriceAndDiscount
- */
- public function setPrice($price)
- {
- $this->price = floatval($price);
- return $this;
- }
- /**
- * Get price
- *
- * @return float
- */
- public function getPrice()
- {
- return $this->price;
- }
- /**
- * Add intangibleDiscountDetail
- *
- * @param \AppBundle\Entity\Product\IntangibleDiscountDetail $intangibleDiscountDetail
- *
- * @return IntangiblePriceAndDiscount
- */
- public function addIntangibleDiscountDetail(\AppBundle\Entity\Product\IntangibleDiscountDetail $intangibleDiscountDetail)
- {
- $intangibleDiscountDetail->setIntangiblePriceAndDiscount($this);
- $this->intangibleDiscountDetails[] = $intangibleDiscountDetail;
- return $this;
- }
- /**
- * Remove intangibleDiscountDetail
- *
- * @param \AppBundle\Entity\Product\IntangibleDiscountDetail $intangibleDiscountDetail
- */
- public function removeIntangibleDiscountDetail(\AppBundle\Entity\Product\IntangibleDiscountDetail $intangibleDiscountDetail)
- {
- $this->intangibleDiscountDetails->removeElement($intangibleDiscountDetail);
- }
- /**
- * Get intangibleDiscountDetails
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getIntangibleDiscountDetails()
- {
- return $this->intangibleDiscountDetails;
- }
- /**
- * Set automaticDiscountCalculation
- *
- * @param boolean $automaticDiscountCalculation
- *
- * @return IntangiblePriceAndDiscount
- */
- public function setAutomaticDiscountCalculation($automaticDiscountCalculation)
- {
- $this->automaticDiscountCalculation = $automaticDiscountCalculation;
- return $this;
- }
- /**
- * Get automaticDiscountCalculation
- *
- * @return boolean
- */
- public function getAutomaticDiscountCalculation()
- {
- return $this->automaticDiscountCalculation;
- }
- }
|