src/Entity/Master/SupplierOperationAlgorithm.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Master;
  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_m_supplier_algorithm")
  9.  * @ORM\Entity(repositoryClass="App\Repository\Master\SupplierOperationAlgorithmRepository")
  10.  */
  11. class SupplierOperationAlgorithm
  12. {
  13.     public function canDelete(){
  14.         if(sizeof($this->getOperation()->getSupplier()->getCompanies()) > 0)
  15.             return false;
  16.         return true;
  17.     }
  18.     
  19.     public function __toString(){
  20.         return $this->name;
  21.     }
  22.     /**
  23.      * @ORM\Column(name="id", type="bigint")
  24.      * @ORM\Id
  25.      * @ORM\GeneratedValue(strategy="AUTO")
  26.      */
  27.     protected $id;
  28.     
  29.     /**
  30.      * @ORM\Column(name="slug", type="string", length=191, unique=true)
  31.      */
  32.     protected $slug;
  33.         
  34.     /**
  35.      * @ORM\Column(name="value", type="string", length=191)
  36.      */
  37.     protected $value;
  38.     // ManyToOne
  39.         /**
  40.          * @ORM\ManyToOne(targetEntity="App\Entity\Master\SupplierOperation", inversedBy="algorithms")
  41.          * @ORM\JoinColumn(name="operation_id", referencedColumnName="id")
  42.          */
  43.         private $operation;
  44.         public function getId(): ?string
  45.         {
  46.             return $this->id;
  47.         }
  48.         public function getSlug(): ?string
  49.         {
  50.             return $this->slug;
  51.         }
  52.         public function setSlug(string $slug): static
  53.         {
  54.             $this->slug $slug;
  55.             return $this;
  56.         }
  57.         public function getValue(): ?string
  58.         {
  59.             return $this->value;
  60.         }
  61.         public function setValue(string $value): static
  62.         {
  63.             $this->value $value;
  64.             return $this;
  65.         }
  66.         public function getOperation(): ?SupplierOperation
  67.         {
  68.             return $this->operation;
  69.         }
  70.         public function setOperation(?SupplierOperation $operation): static
  71.         {
  72.             $this->operation $operation;
  73.             return $this;
  74.         }
  75. }