<?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_activity_type")
* @ORM\Entity(repositoryClass="App\Repository\Slave\InterventionActivityTypeRepository")
*/
class InterventionActivityType
{
public function __toString(){
return $this->getValue();
}
public function getCanDelete(){
if(sizeof($this->activities) > 0) return false;
return true;
}
public function displayOGIds(){
$first = true;
$ids = "";
foreach($this->operationGroups as $og){
if($first) $first = false; else $ids.= ",";
$ids.= $og->getId();
}
return $ids;
}
public function displayOperationGroups()
{
$html = '<table class="m_b_none"><tbody>';
foreach($this->operationGroups as $og){
$html.= '<tr><td>'.$og->getValue().'</td></tr>';
}
$html.= '</tbody></table>';
return $html;
}
/**
* @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="advice", type="string", length=191)
*/
protected $advice;
/**
* @ORM\Column(name="pos", type="boolean")
*/
protected $pos = false;
/**
* @ORM\Column(name="is_only_backoffice", type="boolean")
*/
protected $onlyBackoffice = false;
/**
* @ORM\Column(name="producer_withdraw_mandatory", type="boolean")
*/
protected $producerWithdrawMandatory = false;
/**
* @ORM\Column(name="producer_installation_mandatory", type="boolean")
*/
protected $producerInstallationMandatory = false;
/**
* @ORM\Column(name="producer_actual_mandatory", type="boolean")
*/
protected $producerActualMandatory = false;
/**
* @ORM\Column(name="supplier_withdraw_mandatory", type="boolean")
*/
protected $supplierWithdrawMandatory = false;
/**
* @ORM\Column(name="supplier_installation_mandatory", type="boolean")
*/
protected $supplierInstallationMandatory = false;
/**
* @ORM\Column(name="supplier_actual_mandatory", type="boolean")
*/
protected $supplierActualMandatory = false;
/**
* @ORM\Column(name="is_visible", type="boolean")
*/
protected $visible = true;
// OneToMany
/**
* @ORM\OneToMany(targetEntity="App\Entity\Slave\InterventionActivity", mappedBy="type")
*/
private $activities;
//
// ManyToMany
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Slave\OperationGroup", inversedBy="activityTypes")
* @ORM\JoinTable(name="eposm_s_join_table_operation_group_activity_type")
*/
private $operationGroups;
public function __construct()
{
$this->activities = new ArrayCollection();
$this->operationGroups = 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 getAdvice(): ?string
{
return $this->advice;
}
public function setAdvice(string $advice): static
{
$this->advice = $advice;
return $this;
}
public function isPos(): ?bool
{
return $this->pos;
}
public function setPos(bool $pos): static
{
$this->pos = $pos;
return $this;
}
public function isOnlyBackoffice(): ?bool
{
return $this->onlyBackoffice;
}
public function setOnlyBackoffice(bool $onlyBackoffice): static
{
$this->onlyBackoffice = $onlyBackoffice;
return $this;
}
public function isProducerWithdrawMandatory(): ?bool
{
return $this->producerWithdrawMandatory;
}
public function setProducerWithdrawMandatory(bool $producerWithdrawMandatory): static
{
$this->producerWithdrawMandatory = $producerWithdrawMandatory;
return $this;
}
public function isProducerInstallationMandatory(): ?bool
{
return $this->producerInstallationMandatory;
}
public function setProducerInstallationMandatory(bool $producerInstallationMandatory): static
{
$this->producerInstallationMandatory = $producerInstallationMandatory;
return $this;
}
public function isProducerActualMandatory(): ?bool
{
return $this->producerActualMandatory;
}
public function setProducerActualMandatory(bool $producerActualMandatory): static
{
$this->producerActualMandatory = $producerActualMandatory;
return $this;
}
public function isSupplierWithdrawMandatory(): ?bool
{
return $this->supplierWithdrawMandatory;
}
public function setSupplierWithdrawMandatory(bool $supplierWithdrawMandatory): static
{
$this->supplierWithdrawMandatory = $supplierWithdrawMandatory;
return $this;
}
public function isSupplierInstallationMandatory(): ?bool
{
return $this->supplierInstallationMandatory;
}
public function setSupplierInstallationMandatory(bool $supplierInstallationMandatory): static
{
$this->supplierInstallationMandatory = $supplierInstallationMandatory;
return $this;
}
public function isSupplierActualMandatory(): ?bool
{
return $this->supplierActualMandatory;
}
public function setSupplierActualMandatory(bool $supplierActualMandatory): static
{
$this->supplierActualMandatory = $supplierActualMandatory;
return $this;
}
public function isVisible(): ?bool
{
return $this->visible;
}
public function setVisible(bool $visible): static
{
$this->visible = $visible;
return $this;
}
/**
* @return Collection<int, InterventionActivity>
*/
public function getActivities(): Collection
{
return $this->activities;
}
public function addActivity(InterventionActivity $activity): static
{
if (!$this->activities->contains($activity)) {
$this->activities->add($activity);
$activity->setType($this);
}
return $this;
}
public function removeActivity(InterventionActivity $activity): static
{
if ($this->activities->removeElement($activity)) {
// set the owning side to null (unless already changed)
if ($activity->getType() === $this) {
$activity->setType(null);
}
}
return $this;
}
/**
* @return Collection<int, OperationGroup>
*/
public function getOperationGroups(): Collection
{
return $this->operationGroups;
}
public function addOperationGroup(OperationGroup $operationGroup): static
{
if (!$this->operationGroups->contains($operationGroup)) {
$this->operationGroups->add($operationGroup);
}
return $this;
}
public function removeOperationGroup(OperationGroup $operationGroup): static
{
$this->operationGroups->removeElement($operationGroup);
return $this;
}
}