src/Entity/Cart.php line 9

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CartRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassCartRepository::class)]
  6. class Cart
  7. {
  8.     #[ORM\Id]
  9.     #[ORM\GeneratedValue]
  10.     #[ORM\Column]
  11.     private ?int $id null;
  12.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'cart')]
  13.     private $user;
  14.     #[ORM\ManyToOne(targetEntityProducts::class, inversedBy'cart'fetch'EAGER')]
  15.     private $products;
  16.     #[ORM\Column(name'finish'type'boolean')]
  17.     private ?bool $finish;
  18.     #[ORM\Column(name'commandNumber'type'integer')]
  19.     private ?int $commandNumber;
  20.     #[ORM\Column(name'quantity'type'integer')]
  21.     private ?int $quantity;
  22.     #[ORM\Column(name'message'type'text'nullabletrue)]
  23.     private ?string $message;
  24.     /**
  25.      * @return string|null
  26.      */
  27.     public function getMessage(): ?string
  28.     {
  29.         return $this->message;
  30.     }
  31.     /**
  32.      * @param string|null $message
  33.      */
  34.     public function setMessage(?string $message): void
  35.     {
  36.         $this->message $message;
  37.     }
  38.     /**
  39.      * @return int|null
  40.      */
  41.     public function getQuantity(): ?int
  42.     {
  43.         return $this->quantity;
  44.     }
  45.     /**
  46.      * @param int|null $quantity
  47.      */
  48.     public function setQuantity(?int $quantity): void
  49.     {
  50.         $this->quantity $quantity;
  51.     }
  52.     /**
  53.      * @return int|null
  54.      */
  55.     public function getCommandNumber(): ?int
  56.     {
  57.         return $this->commandNumber;
  58.     }
  59.     /**
  60.      * @param int|null $commandNumber
  61.      */
  62.     public function setCommandNumber(?int $commandNumber): void
  63.     {
  64.         $this->commandNumber $commandNumber;
  65.     }
  66.     /**
  67.      * @return bool|null
  68.      */
  69.     public function getFinish(): ?bool
  70.     {
  71.         return $this->finish;
  72.     }
  73.     /**
  74.      * @param bool|null $finish
  75.      */
  76.     public function setFinish(?bool $finish): void
  77.     {
  78.         $this->finish $finish;
  79.     }
  80.     /**
  81.      * @return mixed
  82.      */
  83.     public function getUser()
  84.     {
  85.         return $this->user;
  86.     }
  87.     /**
  88.      * @param mixed $user
  89.      */
  90.     public function setUser($user): void
  91.     {
  92.         $this->user $user;
  93.     }
  94.     /**
  95.      * @return mixed
  96.      */
  97.     public function getProducts()
  98.     {
  99.         return $this->products;
  100.     }
  101.     /**
  102.      * @param mixed $products
  103.      */
  104.     public function setProducts($products): void
  105.     {
  106.         $this->products $products;
  107.     }
  108.     public function getId(): ?int
  109.     {
  110.         return $this->id;
  111.     }
  112.     public function __toString()
  113.     {
  114.         return $this->products ' -> quantité : ' $this->quantity;
  115.     }
  116. }