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.     //
  51.     public function getId(): ?string
  52.     {
  53.         return $this->id;
  54.     }
  55.     public function getValue(): ?string
  56.     {
  57.         return $this->value;
  58.     }
  59.     public function setValue(string $value): self
  60.     {
  61.         $this->value $value;
  62.         return $this;
  63.     }
  64.     public function getSlug(): ?string
  65.     {
  66.         return $this->slug;
  67.     }
  68.     public function setSlug(string $slug): self
  69.     {
  70.         $this->slug $slug;
  71.         return $this;
  72.     }
  73.     public function getOperation(): ?Operation
  74.     {
  75.         return $this->operation;
  76.     }
  77.     public function setOperation(?Operation $operation): self
  78.     {
  79.         $this->operation $operation;
  80.         return $this;
  81.     }
  82.     /**
  83.      * @return Collection<int, OperationTariffAmount>
  84.      */
  85.     public function getAmounts(): Collection
  86.     {
  87.         return $this->amounts;
  88.     }
  89.     public function addAmount(OperationTariffAmount $amount): self
  90.     {
  91.         if (!$this->amounts->contains($amount)) {
  92.             $this->amounts->add($amount);
  93.             $amount->setAlgorithm($this);
  94.         }
  95.         return $this;
  96.     }
  97.     public function removeAmount(OperationTariffAmount $amount): self
  98.     {
  99.         if ($this->amounts->removeElement($amount)) {
  100.             // set the owning side to null (unless already changed)
  101.             if ($amount->getAlgorithm() === $this) {
  102.                 $amount->setAlgorithm(null);
  103.             }
  104.         }
  105.         return $this;
  106.     }
  107. }