src/Entity/Journal.php line 11

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\JournalRepository;
  4. use App\Trait\DateTrait;
  5. use DateTimeImmutable;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassJournalRepository::class)]
  8. class Journal
  9. {
  10.     use DateTrait;
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(nullabletrue)]
  16.     private array $orders = [];
  17.     #[ORM\Column(nullabletrue)]
  18.     private array $articles = [];
  19.     #[ORM\Column(nullabletrue)]
  20.     private array $articleDepartments = [];
  21.     #[ORM\Column(nullabletrue)]
  22.     private array $clients = [];
  23.     #[ORM\Column(nullabletrue)]
  24.     private array $supplies = [];
  25.     #[ORM\Column(nullabletrue)]
  26.     private array $articleSupplies = [];
  27.     #[ORM\Column(nullabletrue)]
  28.     private array $operations = [];
  29.     #[ORM\Column(nullabletrue)]
  30.     private array $plannings = [];
  31.     #[ORM\Column(nullabletrue)]
  32.     private array $departments = [];
  33.     #[ORM\Column(nullabletrue)]
  34.     private array $employees = [];
  35.     #[ORM\Column(nullabletrue)]
  36.     private array $invitations = [];
  37.     #[ORM\ManyToOne]
  38.     #[ORM\JoinColumn(nullablefalse)]
  39.     private ?User $author null;
  40.     #[ORM\Column(nullabletrue)]
  41.     private array $attendances = [];
  42.     #[ORM\ManyToOne(inversedBy'journals')]
  43.     #[ORM\JoinColumn(nullablefalse)]
  44.     private ?Establishment $establishment null;
  45.     public function __construct()
  46.     {
  47.         if (is_null($this->createdAt)) $this->createdAt = new DateTimeImmutable();
  48.         $this->updatedAt = new DateTimeImmutable();
  49.     }
  50.     public function getId(): ?int
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function getOrders(): array
  55.     {
  56.         return $this->orders;
  57.     }
  58.     public function setOrders(?array $orders): self
  59.     {
  60.         $this->orders $orders;
  61.         return $this;
  62.     }
  63.     public function getArticles(): array
  64.     {
  65.         return $this->articles;
  66.     }
  67.     public function setArticles(?array $articles): self
  68.     {
  69.         $this->articles $articles;
  70.         return $this;
  71.     }
  72.     public function getArticleDepartments(): array
  73.     {
  74.         return $this->articleDepartments;
  75.     }
  76.     public function setArticleDepartments(?array $articleDepartments): self
  77.     {
  78.         $this->articleDepartments $articleDepartments;
  79.         return $this;
  80.     }
  81.     public function getClients(): array
  82.     {
  83.         return $this->clients;
  84.     }
  85.     public function setClients(?array $clients): self
  86.     {
  87.         $this->clients $clients;
  88.         return $this;
  89.     }
  90.     public function getSupplies(): array
  91.     {
  92.         return $this->supplies;
  93.     }
  94.     public function setSupplies(?array $supplies): self
  95.     {
  96.         $this->supplies $supplies;
  97.         return $this;
  98.     }
  99.     public function getArticleSupplies(): array
  100.     {
  101.         return $this->articleSupplies;
  102.     }
  103.     public function setArticleSupplies(?array $articleSupplies): self
  104.     {
  105.         $this->articleSupplies $articleSupplies;
  106.         return $this;
  107.     }
  108.     public function getOperations(): array
  109.     {
  110.         return $this->operations;
  111.     }
  112.     public function setOperations(?array $operations): self
  113.     {
  114.         $this->operations $operations;
  115.         return $this;
  116.     }
  117.     public function getPlannings(): array
  118.     {
  119.         return $this->plannings;
  120.     }
  121.     public function setPlannings(?array $plannings): self
  122.     {
  123.         $this->plannings $plannings;
  124.         return $this;
  125.     }
  126.     public function getDepartments(): array
  127.     {
  128.         return $this->departments;
  129.     }
  130.     public function setDepartments(?array $departments): self
  131.     {
  132.         $this->departments $departments;
  133.         return $this;
  134.     }
  135.     public function getEmployees(): array
  136.     {
  137.         return $this->employees;
  138.     }
  139.     public function setEmployees(?array $employees): self
  140.     {
  141.         $this->employees $employees;
  142.         return $this;
  143.     }
  144.     public function getInvitations(): array
  145.     {
  146.         return $this->invitations;
  147.     }
  148.     public function setInvitations(?array $invitations): self
  149.     {
  150.         $this->invitations $invitations;
  151.         return $this;
  152.     }
  153.     public function getAuthor(): ?User
  154.     {
  155.         return $this->author;
  156.     }
  157.     public function setAuthor(?User $author): self
  158.     {
  159.         $this->author $author;
  160.         return $this;
  161.     }
  162.     public function getAttendances(): array
  163.     {
  164.         return $this->attendances;
  165.     }
  166.     public function setAttendances(?array $attendances): self
  167.     {
  168.         $this->attendances $attendances;
  169.         return $this;
  170.     }
  171.     public function getEstablishment(): ?Establishment
  172.     {
  173.         return $this->establishment;
  174.     }
  175.     public function setEstablishment(?Establishment $establishment): self
  176.     {
  177.         $this->establishment $establishment;
  178.         return $this;
  179.     }
  180.     public function __toString(): string
  181.     {
  182.         return "Journal du {$this->getCreatedAt()->format('d/M/Y')}";
  183.     }
  184. }