<?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_intervention_outcome")
* @ORM\Entity(repositoryClass="App\Repository\Slave\InterventionOutcomeRepository")
*/
class InterventionOutcome
{
public function __toString(){
return $this->getValue();
}
public function getCanDelete(){
if(sizeof($this->interventions) > 0) return false;
return true;
}
/**
* @ORM\Column(name="id", type="bigint")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(name="slug", type="string", length=191, unique=true)
*/
protected $slug;
/**
* @ORM\Column(name="value", type="string", length=191)
*/
protected $value;
/**
* @ORM\Column(name="is_motivation_required", type="boolean")
*/
protected $motivationRequired;
/**
* @ORM\Column(name="is_referent_required", type="boolean")
*/
protected $referentRequired;
/**
* @ORM\Column(name="phone_required", type="boolean")
*/
protected $phoneRequired;
/**
* @ORM\Column(name="photo_required", type="boolean")
*/
protected $photoRequired;
/**
* @ORM\Column(name="suspension_to_required", type="boolean")
*/
protected $suspensionToRequired;
/**
* @ORM\Column(name="is_alarm_material", type="boolean")
*/
protected $alarmMaterial = false;
/**
* @ORM\Column(name="is_visible", type="boolean")
*/
protected $visible = true;
// ManyToOne
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Slave\InterventionOutcomeType", inversedBy="outcomes")
* @ORM\JoinColumn(name="type_id", referencedColumnName="id")
*/
private $type;
//
// OneToMany
/**
* @ORM\OneToMany(targetEntity="App\Entity\Slave\Intervention", mappedBy="outcome")
*/
private $interventions;
public function __construct()
{
$this->interventions = new ArrayCollection();
}
//
public function getId(): ?string
{
return $this->id;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): static
{
$this->slug = $slug;
return $this;
}
public function getValue(): ?string
{
return $this->value;
}
public function setValue(string $value): static
{
$this->value = $value;
return $this;
}
public function isMotivationRequired(): ?bool
{
return $this->motivationRequired;
}
public function setMotivationRequired(bool $motivationRequired): static
{
$this->motivationRequired = $motivationRequired;
return $this;
}
public function isReferentRequired(): ?bool
{
return $this->referentRequired;
}
public function setReferentRequired(bool $referentRequired): static
{
$this->referentRequired = $referentRequired;
return $this;
}
public function isPhoneRequired(): ?bool
{
return $this->phoneRequired;
}
public function setPhoneRequired(bool $phoneRequired): static
{
$this->phoneRequired = $phoneRequired;
return $this;
}
public function isPhotoRequired(): ?bool
{
return $this->photoRequired;
}
public function setPhotoRequired(bool $photoRequired): static
{
$this->photoRequired = $photoRequired;
return $this;
}
public function isSuspensionToRequired(): ?bool
{
return $this->suspensionToRequired;
}
public function setSuspensionToRequired(bool $suspensionToRequired): static
{
$this->suspensionToRequired = $suspensionToRequired;
return $this;
}
public function isAlarmMaterial(): ?bool
{
return $this->alarmMaterial;
}
public function setAlarmMaterial(bool $alarmMaterial): static
{
$this->alarmMaterial = $alarmMaterial;
return $this;
}
public function isVisible(): ?bool
{
return $this->visible;
}
public function setVisible(bool $visible): static
{
$this->visible = $visible;
return $this;
}
public function getType(): ?InterventionOutcomeType
{
return $this->type;
}
public function setType(?InterventionOutcomeType $type): static
{
$this->type = $type;
return $this;
}
/**
* @return Collection<int, Intervention>
*/
public function getInterventions(): Collection
{
return $this->interventions;
}
public function addIntervention(Intervention $intervention): static
{
if (!$this->interventions->contains($intervention)) {
$this->interventions->add($intervention);
$intervention->setOutcome($this);
}
return $this;
}
public function removeIntervention(Intervention $intervention): static
{
if ($this->interventions->removeElement($intervention)) {
// set the owning side to null (unless already changed)
if ($intervention->getOutcome() === $this) {
$intervention->setOutcome(null);
}
}
return $this;
}
}