<?php
namespace App\Entity\Slave;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="eposm_s_operation_algorithm")
* @ORM\Entity
*/
class OperationAlgorithm
{
public function __toString()
{
return $this->getValue();
}
/**
* @ORM\Column(name="id", type="bigint")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(name="value", type="string")
*/
protected $value;
/**
* @ORM\Column(name="slug", type="string")
*/
protected $slug;
// ManyToOne
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Slave\Operation", inversedBy="algorithms")
* @ORM\JoinColumn(name="operation_id", referencedColumnName="id")
*/
private $operation;
//
// OneToMany
/**
* @ORM\OneToMany(targetEntity="App\Entity\Slave\OperationTariffAmount", mappedBy="algorithm")
*/
private $amounts;
public function __construct()
{
$this->amounts = new ArrayCollection();
}
//
public function getId(): ?string
{
return $this->id;
}
public function getValue(): ?string
{
return $this->value;
}
public function setValue(string $value): self
{
$this->value = $value;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getOperation(): ?Operation
{
return $this->operation;
}
public function setOperation(?Operation $operation): self
{
$this->operation = $operation;
return $this;
}
/**
* @return Collection<int, OperationTariffAmount>
*/
public function getAmounts(): Collection
{
return $this->amounts;
}
public function addAmount(OperationTariffAmount $amount): self
{
if (!$this->amounts->contains($amount)) {
$this->amounts->add($amount);
$amount->setAlgorithm($this);
}
return $this;
}
public function removeAmount(OperationTariffAmount $amount): self
{
if ($this->amounts->removeElement($amount)) {
// set the owning side to null (unless already changed)
if ($amount->getAlgorithm() === $this) {
$amount->setAlgorithm(null);
}
}
return $this;
}
}