src/Entity/ActionShock.php line 15

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ActionShockRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. enum ActionShockTypestring
  6. {
  7.     case SHOCK_ACTION 'shock_action';
  8.     case RED_PRICE 'red_price';
  9. }
  10. #[ORM\Entity(repositoryClassActionShockRepository::class)]
  11. class ActionShock
  12. {
  13.     const TYPES = [ActionShockType::SHOCK_ACTION->value => 'Action "CHOC"'ActionShockType::RED_PRICE->value => 'Prix Rouge'];
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\ManyToOne(targetEntityProducts::class, inversedBy'actionShockCalendar'fetch'EAGER')]
  19.     private $product;
  20.     #[ORM\Column(name'dateStart'type'date'nullabletrue)]
  21.     private ?\DateTime $dateStart;
  22.     #[ORM\Column(name'dateEnd'type'date'nullabletrue)]
  23.     private ?\DateTime $dateEnd;
  24.     #[ORM\Column(name'image'type'text'nullabletrue)]
  25.     private ?string $image;
  26.     #[ORM\Column(type"string"enumTypeActionShockType::class, options: ['default' => ActionShockType::SHOCK_ACTION])]
  27.     private ?ActionShockType $type ActionShockType::SHOCK_ACTION;
  28.     #[ORM\Column(name'discountPercent'type'float'options: ['default' => 25])]
  29.     private ?float $discountPercent 25;
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     /**
  35.      * @return mixed
  36.      */
  37.     public function getProduct()
  38.     {
  39.         return $this->product;
  40.     }
  41.     /**
  42.      * @param mixed $product
  43.      */
  44.     public function setProduct($product): void
  45.     {
  46.         $this->product $product;
  47.     }
  48.     /**
  49.      * @return \DateTime|null
  50.      */
  51.     public function getDateStart(): ?\DateTime
  52.     {
  53.         return $this->dateStart;
  54.     }
  55.     /**
  56.      * @param \DateTime|null $dateStart
  57.      */
  58.     public function setDateStart(?\DateTime $dateStart): void
  59.     {
  60.         $this->dateStart $dateStart;
  61.     }
  62.     /**
  63.      * @return \DateTime|null
  64.      */
  65.     public function getDateEnd(): ?\DateTime
  66.     {
  67.         return $this->dateEnd;
  68.     }
  69.     /**
  70.      * @param \DateTime|null $dateEnd
  71.      */
  72.     public function setDateEnd(?\DateTime $dateEnd): void
  73.     {
  74.         $this->dateEnd $dateEnd;
  75.     }
  76.     /**
  77.      * @return string|null
  78.      */
  79.     public function getImage(): ?string
  80.     {
  81.         return $this->image;
  82.     }
  83.     /**
  84.      * @param string|null $image
  85.      */
  86.     public function setImage(?string $image): void
  87.     {
  88.         $this->image $image;
  89.     }
  90.     public function getType(): ?ActionShockType
  91.     {
  92.         return $this->type;
  93.     }
  94.     public function setType(ActionShockType $type): void
  95.     {
  96.         $this->type $type;
  97.     }
  98.     public function getDiscountPercent(): ?float
  99.     {
  100.         return $this->discountPercent;
  101.     }
  102.     public function setDiscountPercent(float $discountPercent): void
  103.     {
  104.         $this->discountPercent $discountPercent;
  105.     }
  106. }