src/Entity/Slave/InterventionOutcome.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_intervention_outcome")
  9.  * @ORM\Entity(repositoryClass="App\Repository\Slave\InterventionOutcomeRepository")
  10.  */
  11. class InterventionOutcome
  12. {    
  13.     public function __toString(){
  14.         return $this->getValue();
  15.     }
  16.     
  17.     public function getCanDelete(){
  18.         if(sizeof($this->interventions) > 0) return false;
  19.         return true;
  20.     }
  21.     /**
  22.      * @ORM\Column(name="id", type="bigint")
  23.      * @ORM\Id
  24.      * @ORM\GeneratedValue(strategy="AUTO")
  25.      */
  26.     protected $id;
  27.     
  28.     /**
  29.      * @ORM\Column(name="slug", type="string", length=191, unique=true)
  30.      */
  31.     protected $slug;
  32.     
  33.     /**
  34.      * @ORM\Column(name="value", type="string", length=191)
  35.      */
  36.     protected $value;
  37.     
  38.     /**
  39.      * @ORM\Column(name="is_motivation_required", type="boolean")
  40.      */
  41.     protected $motivationRequired;
  42.     
  43.     /**
  44.      * @ORM\Column(name="is_referent_required", type="boolean")
  45.      */
  46.     protected $referentRequired;
  47.     
  48.     /**
  49.      * @ORM\Column(name="phone_required", type="boolean")
  50.      */
  51.     protected $phoneRequired;
  52.     
  53.     /**
  54.      * @ORM\Column(name="photo_required", type="boolean")
  55.      */
  56.     protected $photoRequired;
  57.     
  58.     /**
  59.      * @ORM\Column(name="suspension_to_required", type="boolean")
  60.      */
  61.     protected $suspensionToRequired;
  62.     
  63.     /**
  64.      * @ORM\Column(name="is_alarm_material", type="boolean")
  65.      */
  66.     protected $alarmMaterial false;
  67.     
  68.     /**
  69.      * @ORM\Column(name="is_visible", type="boolean")
  70.      */
  71.     protected $visible true;
  72.     // ManyToOne
  73.         /**
  74.          * @ORM\ManyToOne(targetEntity="App\Entity\Slave\InterventionOutcomeType", inversedBy="outcomes")
  75.          * @ORM\JoinColumn(name="type_id", referencedColumnName="id")
  76.          */
  77.         private $type;
  78.     //
  79.     // OneToMany
  80.         /**
  81.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\Intervention", mappedBy="outcome")
  82.          */
  83.         private $interventions;
  84.         public function __construct()
  85.         {
  86.             $this->interventions = new ArrayCollection();
  87.         }
  88.         public function getId(): ?string
  89.         {
  90.             return $this->id;
  91.         }
  92.         public function getSlug(): ?string
  93.         {
  94.             return $this->slug;
  95.         }
  96.         public function setSlug(string $slug): static
  97.         {
  98.             $this->slug $slug;
  99.             return $this;
  100.         }
  101.         public function getValue(): ?string
  102.         {
  103.             return $this->value;
  104.         }
  105.         public function setValue(string $value): static
  106.         {
  107.             $this->value $value;
  108.             return $this;
  109.         }
  110.         public function isMotivationRequired(): ?bool
  111.         {
  112.             return $this->motivationRequired;
  113.         }
  114.         public function setMotivationRequired(bool $motivationRequired): static
  115.         {
  116.             $this->motivationRequired $motivationRequired;
  117.             return $this;
  118.         }
  119.         public function isReferentRequired(): ?bool
  120.         {
  121.             return $this->referentRequired;
  122.         }
  123.         public function setReferentRequired(bool $referentRequired): static
  124.         {
  125.             $this->referentRequired $referentRequired;
  126.             return $this;
  127.         }
  128.         public function isPhoneRequired(): ?bool
  129.         {
  130.             return $this->phoneRequired;
  131.         }
  132.         public function setPhoneRequired(bool $phoneRequired): static
  133.         {
  134.             $this->phoneRequired $phoneRequired;
  135.             return $this;
  136.         }
  137.         public function isPhotoRequired(): ?bool
  138.         {
  139.             return $this->photoRequired;
  140.         }
  141.         public function setPhotoRequired(bool $photoRequired): static
  142.         {
  143.             $this->photoRequired $photoRequired;
  144.             return $this;
  145.         }
  146.         public function isSuspensionToRequired(): ?bool
  147.         {
  148.             return $this->suspensionToRequired;
  149.         }
  150.         public function setSuspensionToRequired(bool $suspensionToRequired): static
  151.         {
  152.             $this->suspensionToRequired $suspensionToRequired;
  153.             return $this;
  154.         }
  155.         public function isAlarmMaterial(): ?bool
  156.         {
  157.             return $this->alarmMaterial;
  158.         }
  159.         public function setAlarmMaterial(bool $alarmMaterial): static
  160.         {
  161.             $this->alarmMaterial $alarmMaterial;
  162.             return $this;
  163.         }
  164.         public function isVisible(): ?bool
  165.         {
  166.             return $this->visible;
  167.         }
  168.         public function setVisible(bool $visible): static
  169.         {
  170.             $this->visible $visible;
  171.             return $this;
  172.         }
  173.         public function getType(): ?InterventionOutcomeType
  174.         {
  175.             return $this->type;
  176.         }
  177.         public function setType(?InterventionOutcomeType $type): static
  178.         {
  179.             $this->type $type;
  180.             return $this;
  181.         }
  182.         /**
  183.          * @return Collection<int, Intervention>
  184.          */
  185.         public function getInterventions(): Collection
  186.         {
  187.             return $this->interventions;
  188.         }
  189.         public function addIntervention(Intervention $intervention): static
  190.         {
  191.             if (!$this->interventions->contains($intervention)) {
  192.                 $this->interventions->add($intervention);
  193.                 $intervention->setOutcome($this);
  194.             }
  195.             return $this;
  196.         }
  197.         public function removeIntervention(Intervention $intervention): static
  198.         {
  199.             if ($this->interventions->removeElement($intervention)) {
  200.                 // set the owning side to null (unless already changed)
  201.                 if ($intervention->getOutcome() === $this) {
  202.                     $intervention->setOutcome(null);
  203.                 }
  204.             }
  205.             return $this;
  206.         }
  207. }