src/Entity/Company.php line 9

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CompanyRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassCompanyRepository::class)]
  6. class Company
  7. {
  8.     #[ORM\Id]
  9.     #[ORM\GeneratedValue]
  10.     #[ORM\Column]
  11.     private ?int $id null;
  12.     #[ORM\OneToOne(mappedBy'company'cascade: ['persist''remove'])]
  13.     private ?SriInfo $sriInfo null;
  14.     #[ORM\ManyToOne(inversedBy'companies')]
  15.     #[ORM\JoinColumn(nullablefalse)]
  16.     private ?User $owner null;
  17.     public function getId(): ?int
  18.     {
  19.         return $this->id;
  20.     }
  21.     public function getSriInfo(): ?SriInfo
  22.     {
  23.         return $this->sriInfo;
  24.     }
  25.     public function setSriInfo(?SriInfo $sriInfo): static
  26.     {
  27.         // unset the owning side of the relation if necessary
  28.         if ($sriInfo === null && $this->sriInfo !== null) {
  29.             $this->sriInfo->setCompany(null);
  30.         }
  31.         // set the owning side of the relation if necessary
  32.         if ($sriInfo !== null && $sriInfo->getCompany() !== $this) {
  33.             $sriInfo->setCompany($this);
  34.         }
  35.         $this->sriInfo $sriInfo;
  36.         return $this;
  37.     }
  38.     public function getOwner(): ?User
  39.     {
  40.         return $this->owner;
  41.     }
  42.     public function setOwner(?User $owner): static
  43.     {
  44.         $this->owner $owner;
  45.         return $this;
  46.     }
  47. }