src/Entity/Slave/OperationAlgorithm.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Slave;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Table(name="eposm_s_operation_algorithm")
  9.  * @ORM\Entity
  10.  */
  11. class OperationAlgorithm
  12. {
  13.     public function __toString()
  14.                                   {
  15.                                       return $this->getValue();
  16.                                   }
  17.     
  18.     /**
  19.      * @ORM\Column(name="id", type="bigint")
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="AUTO")
  22.      */
  23.     protected $id;
  24.         
  25.     /**
  26.      * @ORM\Column(name="value", type="string")
  27.      */
  28.     protected $value;
  29.     /**
  30.      * @ORM\Column(name="slug", type="string")
  31.      */
  32.     protected $slug;
  33.     // ManyToOne
  34.         /**
  35.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\Operation", inversedBy="algorithms")
  36.          * @ORM\JoinColumn(name="operation_id", referencedColumnName="id")
  37.          */
  38.         private $operation;
  39.     //
  40.     
  41.     // OneToMany
  42.         /**
  43.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\OperationTariffAmount", mappedBy="algorithm")
  44.          */
  45.         private $amounts;
  46.         public function __construct()
  47.         {
  48.             $this->amounts = new ArrayCollection();
  49.         }
  50.         public function getId(): ?string
  51.         {
  52.             return $this->id;
  53.         }
  54.         public function getValue(): ?string
  55.         {
  56.             return $this->value;
  57.         }
  58.         public function setValue(string $value): static
  59.         {
  60.             $this->value $value;
  61.             return $this;
  62.         }
  63.         public function getSlug(): ?string
  64.         {
  65.             return $this->slug;
  66.         }
  67.         public function setSlug(string $slug): static
  68.         {
  69.             $this->slug $slug;
  70.             return $this;
  71.         }
  72.         public function getOperation(): ?Operation
  73.         {
  74.             return $this->operation;
  75.         }
  76.         public function setOperation(?Operation $operation): static
  77.         {
  78.             $this->operation $operation;
  79.             return $this;
  80.         }
  81.         /**
  82.          * @return Collection<int, OperationTariffAmount>
  83.          */
  84.         public function getAmounts(): Collection
  85.         {
  86.             return $this->amounts;
  87.         }
  88.         public function addAmount(OperationTariffAmount $amount): static
  89.         {
  90.             if (!$this->amounts->contains($amount)) {
  91.                 $this->amounts->add($amount);
  92.                 $amount->setAlgorithm($this);
  93.             }
  94.             return $this;
  95.         }
  96.         public function removeAmount(OperationTariffAmount $amount): static
  97.         {
  98.             if ($this->amounts->removeElement($amount)) {
  99.                 // set the owning side to null (unless already changed)
  100.                 if ($amount->getAlgorithm() === $this) {
  101.                     $amount->setAlgorithm(null);
  102.                 }
  103.             }
  104.             return $this;
  105.         }
  106. }