src/Entity/OfferStatus.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\OfferStatusRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=OfferStatusRepository::class)
  9.  */
  10. class OfferStatus
  11. {
  12.     const OFFER_STATUS_LETREHOZOTT 1;
  13.     const OFFER_STATUS_ELFOGADOTT 2;
  14.     const OFFER_STATUS_VISSZAUTASITOTT 3;
  15.     const OFFER_STATUS_BEFEJEZETT 4;
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $name;
  26.     /**
  27.      * @ORM\OneToMany(targetEntity=Offer::class, mappedBy="status")
  28.      */
  29.     private $offers;
  30.     public function __construct()
  31.     {
  32.         $this->offers = new ArrayCollection();
  33.     }
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getName(): ?string
  39.     {
  40.         return $this->name;
  41.     }
  42.     public function setName(string $name): self
  43.     {
  44.         $this->name $name;
  45.         return $this;
  46.     }
  47.     /**
  48.      * @return Collection<int, Offer>
  49.      */
  50.     public function getOffers(): Collection
  51.     {
  52.         return $this->offers;
  53.     }
  54.     public function addOffer(Offer $offer): self
  55.     {
  56.         if (!$this->offers->contains($offer)) {
  57.             $this->offers[] = $offer;
  58.             $offer->setStatus($this);
  59.         }
  60.         return $this;
  61.     }
  62.     public function removeOffer(Offer $offer): self
  63.     {
  64.         if ($this->offers->removeElement($offer)) {
  65.             // set the owning side to null (unless already changed)
  66.             if ($offer->getStatus() === $this) {
  67.                 $offer->setStatus(null);
  68.             }
  69.         }
  70.         return $this;
  71.     }
  72. }