| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <?php
- declare(strict_types=1);
- namespace App\Entity\Network;
- use ApiPlatform\Metadata\ApiResource;
- use App\Attribute\DateTimeConstraintAware;
- use App\Entity\Organization\Organization;
- use App\Entity\Traits\CreatedOnAndByTrait;
- use App\Repository\Network\NetworkOrganizationRepository;
- // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Component\Serializer\Annotation\Groups;
- /**
- * Fait le lien entre une Organization et un Network.
- *
- * Security :
- *
- * * @see App\Doctrine\Network\CurrentNetworkOrganizationExtension
- */
- #[ApiResource(operations: [])]
- // #[Auditable]
- #[ORM\Entity(repositoryClass: NetworkOrganizationRepository::class)]
- #[DateTimeConstraintAware(startDateFieldName: 'startDate', endDateFieldName: 'endDate')]
- class NetworkOrganization
- {
- use CreatedOnAndByTrait;
- #[ORM\Id]
- #[ORM\Column]
- #[ORM\GeneratedValue]
- #[Groups('network')]
- private ?int $id = null;
- #[ORM\ManyToOne(inversedBy: 'organizations')]
- #[ORM\JoinColumn(nullable: true)]
- #[Groups('network')]
- private Network $network;
- #[ORM\ManyToOne(inversedBy: 'networkOrganizations')]
- #[ORM\JoinColumn(nullable: true)]
- private Organization $organization;
- #[ORM\ManyToOne(inversedBy: 'networkOrganizationChildren')]
- private ?Organization $parent;
- #[ORM\Column(length: 255, nullable: true)]
- private ?string $leadingCause = null;
- #[ORM\Column(type: 'date', nullable: true)]
- #[Groups('network')]
- private ?\DateTimeInterface $startDate = null;
- #[ORM\Column(type: 'date', nullable: true)]
- private ?\DateTimeInterface $endDate = null;
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getNetwork(): ?Network
- {
- return $this->network;
- }
- public function setNetwork(?Network $network): self
- {
- $this->network = $network;
- return $this;
- }
- public function getOrganization(): ?Organization
- {
- return $this->organization;
- }
- public function setOrganization(?Organization $organization): self
- {
- $this->organization = $organization;
- return $this;
- }
- public function getParent(): ?Organization
- {
- return $this->parent;
- }
- public function setParent(?Organization $parent): self
- {
- $this->parent = $parent;
- return $this;
- }
- public function getLeadingCause(): ?string
- {
- return $this->leadingCause;
- }
- public function setLeadingCause(?string $leadingCause): self
- {
- $this->leadingCause = $leadingCause;
- return $this;
- }
- public function getStartDate(): ?\DateTimeInterface
- {
- return $this->startDate;
- }
- public function setStartDate(?\DateTime $startDate = null): self
- {
- if ($startDate == null) {
- $startDate = new \DateTime();
- }
- $this->startDate = $startDate;
- return $this;
- }
- public function getEndDate(): ?\DateTimeInterface
- {
- return $this->endDate;
- }
- public function setEndDate(?\DateTime $endDate = null): self
- {
- $this->endDate = $endDate;
- return $this;
- }
- }
|