| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339 |
- <?php
- namespace AppBundle\Entity\Core;
- use AppBundle\Entity\AccessAndFunction\Access;
- 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;
- /**
- * Classe de base de @see PlaceRepair, RoomRepair, EquipmentRepair
- *
- * @author vincent
- *
- */
- #[ORM\Entity]
- #[ORM\Table(name: 'Repair')]
- #[ORM\InheritanceType('SINGLE_TABLE')]
- #[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
- #[ORM\DiscriminatorMap(['place' => 'AppBundle\Entity\Place\PlaceRepair', 'room' => 'AppBundle\Entity\Place\RoomRepair', 'equipment' => 'AppBundle\Entity\Product\EquipmentRepair'])]
- abstract class AbstractRepair
- {
- use TimestampableEntity;
- use CreatorUpdaterEntity;
- use ActivityPeriodTrait;
- /**
- * @var int
- */
- #[ORM\Column(type: 'integer')]
- #[ORM\Id]
- #[ORM\GeneratedValue(strategy: 'AUTO')]
- #[Groups(['repair', 'equipmentrepair_list', 'placerepair_list', 'equipment_details', 'repair_edit'])]
- private $id;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Assert\Choice(callback: ['AppBundle\Enum\Core\RepairTypeEnum', 'toArray'])]
- #[Groups(['repair', 'equipmentrepair_list', 'placerepair_list', 'equipment_details_equipmentrepair', 'repair_edit'])]
- private $repairType;
- /**
- * @var string
- */
- #[ORM\Column(type: 'text', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['repair', 'equipmentrepair_list', 'placerepair_list', 'repair_edit'])]
- private $workToDo;
- /**
- * @var Access
- */
- #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access')]
- #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
- #[Groups(['repair', 'equipmentrepair_list', 'placerepair_list', 'equipment_details_equipmentrepair', 'repair_edit'])]
- private $provider;
- /**
- * @var string
- */
- #[ORM\Column(type: 'text', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['repair', 'equipmentrepair_list', 'placerepair_list', 'repair_edit'])]
- private $workDoing;
- /**
- * @var float
- */
- #[ORM\Column(type: 'float', nullable: true)]
- #[Assert\Type(type: 'float')]
- #[Groups(['repair', 'equipmentrepair_list', 'placerepair_list', 'repair_edit'])]
- private $cost;
- /**
- * @var float
- */
- #[ORM\Column(type: 'float', nullable: true)]
- #[Assert\Type(type: 'float')]
- #[Groups(['repair', 'equipmentrepair_list', 'placerepair_list', 'repair_edit'])]
- private $tva;
- /**
- * @var int
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Groups(['repair', 'equipmentrepair_list', 'placerepair_list', 'repair_edit'])]
- private $invoiceNumber;
- /**
- * @var string
- */
- #[ORM\Column(type: 'string', nullable: true)]
- #[Assert\Type(type: 'string')]
- #[Assert\Choice(callback: ['AppBundle\Enum\Core\AppreciationEnum', 'toArray'])]
- #[Groups(['repair', 'equipmentrepair_list', 'placerepair_list', 'repair_edit'])]
- private $appreciation;
- /**
- * @var ArrayCollection<Tagg>
- */
- #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\Tagg', cascade: ['persist'], inversedBy: 'repairs')]
- #[Assert\Valid]
- #[ORM\JoinTable(name: 'tag_repair', joinColumns: [], inverseJoinColumns: [])]
- #[ORM\JoinColumn(name: 'repair_id', referencedColumnName: 'id')]
- #[ORM\JoinColumn(name: 'tag_id', referencedColumnName: 'id')]
- #[Groups(['repair_tags', 'manage_tags', 'equipmentrepair_list', 'repair_edit'])]
- 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 repairType.
- *
- * @param string $repairType
- *
- * @return $this
- */
- public function setRepairType($repairType)
- {
- $this->repairType = $repairType;
- return $this;
- }
- /**
- * Gets RepairType.
- *
- * @return string
- */
- public function getRepairType()
- {
- return $this->repairType;
- }
- /**
- * Sets workToDo.
- *
- * @param string $workToDo
- *
- * @return $this
- */
- public function setWorkToDo($workToDo)
- {
- $this->workToDo = $workToDo;
- return $this;
- }
- /**
- * Gets workToDo.
- *
- * @return string
- */
- public function getWorkToDo()
- {
- return $this->workToDo;
- }
- /**
- * Sets provider.
- *
- * @param Access $provider
- *
- * @return $this
- */
- public function setProvider(Access $provider = null)
- {
- $this->provider = $provider;
- return $this;
- }
- /**
- * Gets provider.
- *
- * @return Access
- */
- public function getProvider()
- {
- return $this->provider;
- }
- /**
- * 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 cost.
- *
- * @param float $cost
- *
- * @return $this
- */
- public function setCost($cost)
- {
- $this->cost = floatval($cost);
- return $this;
- }
- /**
- * Gets cost.
- *
- * @return float
- */
- public function getCost()
- {
- return $this->cost;
- }
- /**
- * Sets tva.
- *
- * @param float $tva
- *
- * @return $this
- */
- public function setTva($tva)
- {
- $this->tva = floatval($tva);
- return $this;
- }
- /**
- * Gets tva.
- *
- * @return float
- */
- public function getTva()
- {
- return $this->tva;
- }
- /**
- * Sets invoiceNumber.
- *
- * @param string $invoiceNumber
- *
- * @return $this
- */
- public function setInvoiceNumber($invoiceNumber)
- {
- $this->invoiceNumber = $invoiceNumber;
- return $this;
- }
- /**
- * Gets invoiceNumber.
- *
- * @return string
- */
- public function getInvoiceNumber()
- {
- return $this->invoiceNumber;
- }
- /**
- * Sets appreciation.
- *
- * @param string $appreciation
- *
- * @return $this
- */
- public function setAppreciation($appreciation)
- {
- $this->appreciation = $appreciation;
- return $this;
- }
- /**
- * Gets appreciation.
- *
- * @return string
- */
- public function getAppreciation()
- {
- return $this->appreciation;
- }
- /**
- * Add tag
- *
- * @param \AppBundle\Entity\Core\Tagg $tag
- *
- * @return AbstractRepair
- */
- 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;
- }
- }
|