src/Entity/Api.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ApiRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassApiRepository::class)]
  8. class Api
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'string'length255)]
  15.     private $name;
  16.     #[ORM\Column(type'datetime')]
  17.     private $modified;
  18.     #[ORM\Column(type'datetime')]
  19.     private $created;
  20.     #[ORM\OneToMany(targetEntityApiDetails::class, mappedBy'api')]
  21.     private $apiDetails;
  22.     public function __construct()
  23.     {
  24.         $this->setModified(new \DateTime());
  25.         if ($this->getCreated() == null) {
  26.             $this->setCreated(new \DateTime());
  27.         }
  28.         $this->apiDetails = new ArrayCollection();
  29.     }
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getName(): ?string
  35.     {
  36.         return $this->name;
  37.     }
  38.     public function setName(string $name): self
  39.     {
  40.         $this->name $name;
  41.         return $this;
  42.     }
  43.     public function getModified(): ?\DateTimeInterface
  44.     {
  45.         return $this->modified;
  46.     }
  47.     public function setModified(\DateTimeInterface $modified): self
  48.     {
  49.         $this->modified $modified;
  50.         return $this;
  51.     }
  52.     public function getCreated(): ?\DateTimeInterface
  53.     {
  54.         return $this->created;
  55.     }
  56.     public function setCreated(\DateTimeInterface $created): self
  57.     {
  58.         $this->created $created;
  59.         return $this;
  60.     }
  61.     /**
  62.      * @return Collection<int, ApiDetails>
  63.      */
  64.     public function getApiDetails(): Collection
  65.     {
  66.         return $this->apiDetails;
  67.     }
  68.     public function addApiDetail(ApiDetails $apiDetail): self
  69.     {
  70.         if (!$this->apiDetails->contains($apiDetail)) {
  71.             $this->apiDetails[] = $apiDetail;
  72.             $apiDetail->setApi($this);
  73.         }
  74.         return $this;
  75.     }
  76.     public function removeApiDetail(ApiDetails $apiDetail): self
  77.     {
  78.         if ($this->apiDetails->removeElement($apiDetail)) {
  79.             // set the owning side to null (unless already changed)
  80.             if ($apiDetail->getApi() === $this) {
  81.                 $apiDetail->setApi(null);
  82.             }
  83.         }
  84.         return $this;
  85.     }
  86. }