src/Entity/CRM/Contract.php line 10

  1. <?php
  2. namespace App\Entity\CRM;
  3. use App\Entity\CRM\Order;
  4. use App\Repository\ContractRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassContractRepository::class)]
  7. class Contract
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column]
  12.     private ?int $id null;
  13.     #[ORM\Column(length255)]
  14.     private ?string $name null;
  15.     #[ORM\OneToOne(mappedBy'contract'cascade: ['persist''remove'])]
  16.     private ?Order $orderInstance null;
  17.     #[ORM\ManyToOne(inversedBy'contracts')]
  18.     #[ORM\JoinColumn(nullablefalse)]
  19.     private ?ContractTemplate $contractTemplate null;
  20.     #[ORM\ManyToOne(targetEntityself::class)]
  21.     private ?self $parentContract null;
  22.     public function __toString(): string
  23.     {
  24.         return $this->name;
  25.     }
  26.     public function getId(): ?int
  27.     {
  28.         return $this->id;
  29.     }
  30.     public function getName(): ?string
  31.     {
  32.         return $this->name;
  33.     }
  34.     public function setName(string $name): static
  35.     {
  36.         $this->name $name;
  37.         return $this;
  38.     }
  39.     public function getOrderInstance(): ?Order
  40.     {
  41.         return $this->orderInstance;
  42.     }
  43.     public function setOrderInstance(?Order $orderInstance): static
  44.     {
  45.         // unset the owning side of the relation if necessary
  46.         if ($orderInstance === null && $this->orderInstance !== null) {
  47.             $this->orderInstance->setContract(null);
  48.         }
  49.         // set the owning side of the relation if necessary
  50.         if ($orderInstance !== null && $orderInstance->getContract() !== $this) {
  51.             $orderInstance->setContract($this);
  52.         }
  53.         $this->orderInstance $orderInstance;
  54.         return $this;
  55.     }
  56.     public function getContractTemplate(): ?ContractTemplate
  57.     {
  58.         return $this->contractTemplate;
  59.     }
  60.     public function setContractTemplate(?ContractTemplate $contractTemplate): static
  61.     {
  62.         $this->contractTemplate $contractTemplate;
  63.         return $this;
  64.     }
  65.     public function getParentContract(): ?Contract
  66.     {
  67.         return $this->parentContract;
  68.     }
  69.     public function setParentContract(?Contract $parentContract): void
  70.     {
  71.         $this->parentContract $parentContract;
  72.     }
  73. }