| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395 |
- <?php
- namespace AppBundle\Entity\Core;
- use AppBundle\Entity\AccessAndFunction\Access;
- use AppBundle\Entity\Person\Person;
- use AppBundle\Entity\Traits\ActivityPeriodTrait;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\ORM\Mapping as ORM;
- use Dunglas\ApiBundle\Annotation\Iri;
- use Symfony\Component\Serializer\Annotation\Groups;
- use Symfony\Component\Validator\Constraints as Assert;
- use AppBundle\Entity\Traits\TimestampableEntity;
- use AppBundle\Entity\Traits\CreatorUpdaterEntity;
- /**
- * Contrôle du bon état des Place, Room et Equipment, effectué ou planifié
- * Classe de base de @see PlaceControl, RoomControl, EquipmentControl
- *
- * @author vincent
- *
- */
- #[ORM\Entity]
- #[ORM\Table(name: 'Control')]
- #[ORM\InheritanceType('SINGLE_TABLE')]
- #[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
- #[ORM\DiscriminatorMap(['place' => 'AppBundle\Entity\Place\PlaceControl', 'room' => 'AppBundle\Entity\Place\RoomControl', 'equipment' => 'AppBundle\Entity\Product\EquipmentControl'])]
- abstract class AbstractControl
- {
- use TimestampableEntity;
- use CreatorUpdaterEntity;
- use ActivityPeriodTrait;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer')]
- #[ORM\Id]
- #[ORM\GeneratedValue(strategy: 'AUTO')]
- #[Groups(['control', 'equipmentcontrol_list', 'placecontrol_list', 'equipment_details', 'control_edit'])]
- private $id;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Assert\Choice(callback: ['\AppBundle\Enum\Product\ControlTypeEnum', 'toArray'])]
- #[Groups(['control', 'equipmentcontrol_list', 'placecontrol_list', 'equipment_details_equipmentcontrol', 'control_edit'])]
- private $controlType;
- /**
- * @var bool
- */
- #[ORM\Column(type: 'boolean', nullable: true)]
- #[Assert\Type(type: 'boolean')]
- #[Groups(['control', 'equipmentcontrol_list', 'placecontrol_list', 'control_edit'])]
- private $report;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['control', 'equipmentcontrol_list', 'placecontrol_list', 'equipment_details_equipmentcontrol', 'control_edit'])]
- private $operator;
- /**
- * @var string
- */
- #[ORM\Column(type: 'text', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['control', 'equipmentcontrol_list', 'placecontrol_list', 'control_edit'])]
- private $finding;
- /**
- * @var string
- */
- #[ORM\Column(type: 'text', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['control', 'equipmentcontrol_list', 'placecontrol_list', 'control_edit'])]
- private $workDoing;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer', nullable: true)]
- #[Assert\Type(type: 'integer', message: 'invalid-integer')]
- #[Groups(['control', 'equipmentcontrol_list', 'equipment_details_equipmentcontrol', 'control_edit'])]
- private $lifeBalance;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer', nullable: true)]
- #[Assert\Type(type: 'integer', message: 'invalid-integer')]
- #[Groups(['control', 'equipmentcontrol_list', 'control_edit'])]
- private $usedDuration;
- /**
- * @var Access
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'accompanistControl')]
- #[ORM\JoinColumn(nullable: true)]
- #[Groups(['control', 'equipmentcontrol_list', 'control_edit'])]
- private $accompanist;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer', nullable: true)]
- #[Assert\Type(type: 'integer', message: 'invalid-integer')]
- #[Groups(['control', 'equipmentcontrol_list', 'equipment_details_equipmentcontrol', 'control_edit'])]
- private $balanceUsefulLife;
- /**
- * @var \DateTime
- */
- #[ORM\Column(type: 'date', nullable: true)]
- #[Assert\Date]
- #[Groups(['control', 'equipmentcontrol_list', 'placecontrol_list', 'equipment_details_equipmentcontrol', 'control_edit'])]
- private $nextControl;
- /**
- * @var ArrayCollection<Tagg>
- */
- #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\Tagg', cascade: ['persist'], inversedBy: 'controls')]
- #[Assert\Valid]
- #[ORM\JoinTable(name: 'tag_control', joinColumns: [], inverseJoinColumns: [])]
- #[ORM\JoinColumn(name: 'control_id', referencedColumnName: 'id')]
- #[ORM\JoinColumn(name: 'tag_id', referencedColumnName: 'id')]
- #[Groups(['control_tags', 'manage_tags', 'equipmentcontrol_list'])]
- private $tags;
- public function __construct() {
- $this->tags = new ArrayCollection();
- }
- /**
- * Sets id.
- *
- * @param int $id
- *
- * @return $this
- */
- public function setId($id)
- {
- $this->id = $id;
- return $this;
- }
- /**
- * Gets id.
- *
- * @return int
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Sets controlType.
- *
- * @param string $controlType
- *
- * @return $this
- */
- public function setControlType($controlType)
- {
- $this->controlType = $controlType;
- return $this;
- }
- /**
- * Gets controlType.
- *
- * @return string
- */
- public function getControlType()
- {
- return $this->controlType;
- }
- /**
- * Sets report.
- *
- * @param bool $report
- *
- * @return $this
- */
- public function setReport($report)
- {
- $this->report = $report;
- return $this;
- }
- /**
- * Gets report.
- *
- * @return bool
- */
- public function getReport()
- {
- return $this->report;
- }
- /**
- * Sets operator.
- *
- * @param string $operator
- *
- * @return $this
- */
- public function setOperator($operator)
- {
- $this->operator = $operator;
- return $this;
- }
- /**
- * Gets operator.
- *
- * @return string
- */
- public function getOperator()
- {
- return $this->operator;
- }
- /**
- * Sets finding.
- *
- * @param string $finding
- *
- * @return $this
- */
- public function setFinding($finding)
- {
- $this->finding = $finding;
- return $this;
- }
- /**
- * Gets finding.
- *
- * @return string
- */
- public function getFinding()
- {
- return $this->finding;
- }
- /**
- * Sets workDoing.
- *
- * @param string $workDoing
- *
- * @return $this
- */
- public function setWorkDoing($workDoing)
- {
- $this->workDoing = $workDoing;
- return $this;
- }
- /**
- * Gets workDoing.
- *
- * @return string
- */
- public function getWorkDoing()
- {
- return $this->workDoing;
- }
- /**
- * Sets lifeBalance.
- *
- * @param int $lifeBalance
- *
- * @return $this
- */
- public function setLifeBalance($lifeBalance)
- {
- $this->lifeBalance = $lifeBalance;
- return $this;
- }
- /**
- * Gets lifeBalance.
- *
- * @return int
- */
- public function getLifeBalance()
- {
- return $this->lifeBalance;
- }
- /**
- * Sets usedDuration.
- *
- * @param int $usedDuration
- *
- * @return $this
- */
- public function setUsedDuration($usedDuration)
- {
- $this->usedDuration = $usedDuration;
- return $this;
- }
- /**
- * Gets usedDuration.
- *
- * @return int
- */
- public function getUsedDuration()
- {
- return $this->usedDuration;
- }
- /**
- * @param Access|null $accompanist
- * @return $this
- */
- public function setAccompanist(Access $accompanist = null)
- {
- $this->accompanist = $accompanist;
- return $this;
- }
- /**
- * Gets accompanist.
- *
- * @return Access
- */
- public function getAccompanist()
- {
- return $this->accompanist;
- }
- /**
- * Sets balanceUsefulLife.
- *
- * @param int $balanceUsefulLife
- *
- * @return $this
- */
- public function setBalanceUsefulLife($balanceUsefulLife)
- {
- $this->balanceUsefulLife = $balanceUsefulLife;
- return $this;
- }
- /**
- * Gets balanceUsefulLife.
- *
- * @return int
- */
- public function getBalanceUsefulLife()
- {
- return $this->balanceUsefulLife;
- }
- /**
- * Sets nextControl.
- *
- * @param \DateTime $nextControl
- *
- * @return $this
- */
- public function setNextControl(\DateTime $nextControl = null)
- {
- $this->nextControl = $nextControl;
- return $this;
- }
- /**
- * Gets nextControl.
- *
- * @return \DateTime
- */
- public function getNextControl()
- {
- return $this->nextControl ? $this->nextControl->format('Y-m-d') : $this->nextControl;
- }
- /**
- * Add tag
- *
- * @param \AppBundle\Entity\Core\Tagg $tag
- *
- * @return AbstractControl
- */
- public function addTag(\AppBundle\Entity\Core\Tagg $tag)
- {
- $this->tags[] = $tag;
- return $this;
- }
- /**
- * Remove tag
- *
- * @param \AppBundle\Entity\Core\Tagg $tag
- */
- public function removeTag(\AppBundle\Entity\Core\Tagg $tag)
- {
- $this->tags->removeElement($tag);
- }
- /**
- * Get tags
- *
- * @return \Doctrine\Common\Collections\Collection
- */
- public function getTags()
- {
- return $this->tags;
- }
- }
|