src/Entity/Maintenance/Maintenance.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Maintenance;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Symfony\Component\Validator\Constraints AS Constraints;
  5. use Symfony\Component\Validator\Constraints AS Assert;
  6. use Doctrine\ORM\Mapping AS ORM;
  7. use Ramsey\Uuid\Uuid;
  8. use Ramsey\Uuid\Lazy\LazyUuidFromString;
  9. use App\Entity\BaseEntity;
  10. use App\Entity\Properties\Property;
  11. use App\Entity\Statements\Item;
  12. /**
  13.  * @ORM\Entity(repositoryClass="App\Repository\Maintenance\MaintenanceRepository")
  14.  * @ORM\Table(name="maintenance_maintenance")
  15.  */
  16. class Maintenance extends BaseEntity
  17. {
  18.     /**
  19.     * @ORM\Id
  20.     * @ORM\GeneratedValue(strategy="AUTO")
  21.     * @ORM\Column(type="integer")
  22.     */
  23.     private $id;
  24.     /**
  25.      * @ORM\Column(type="uuid")
  26.      * @Assert\Uuid
  27.      */
  28.     protected $uuid;
  29.     /**
  30.      * @var \DateTime
  31.      *
  32.      * @ORM\Column(type="datetime", nullable=false)
  33.      * @Assert\Type("\DateTime")
  34.      */
  35.     private $created;
  36.     /**
  37.     * @ORM\Column(type="integer", nullable=false)
  38.     */
  39.     private $reference;
  40.     /**
  41.     * @ORM\Column(type="string", nullable=false, length="250")
  42.     */
  43.     private $description;
  44.     /**
  45.     * @ORM\Column(type="integer", nullable=false, length="10")
  46.     */
  47.     private $rate;
  48.     /**
  49.     * @ORM\Column(type="integer", nullable=false, length="10")
  50.     */
  51.     private $cost;
  52.     /**
  53.      * @ORM\ManyToOne(targetEntity=Property::class, inversedBy="maintenance")
  54.      * @ORM\JoinColumn(nullable=false)
  55.      **/
  56.     private $property;
  57.     /**
  58.      * @ORM\OneToOne(targetEntity=Item::class, mappedBy="maintenance")
  59.      * @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
  60.      **/
  61.     private $statementItem;
  62.     public function __construct(array $defaults = array())
  63.     {
  64.         // Defaults
  65.         $this->setUuid(Uuid::uuid4());
  66.         $this->setCreated(new \DateTime());
  67.         $this->rate 0;
  68.         $this->cost 0;
  69.         parent::__construct($defaults);
  70.     }
  71.     public function __toString()
  72.     {
  73.         return $this->getId();
  74.     }
  75.     public function getId(): ?int
  76.     {
  77.         return $this->id;
  78.     }
  79.     public function getUuid(): LazyUuidFromString
  80.     {
  81.         return $this->uuid;
  82.     }
  83.     public function setUuid(LazyUuidFromString $uuid): void
  84.     {
  85.         $this->uuid $uuid;
  86.     }
  87.     public function setCreated(\DateTime $created): void
  88.     {
  89.         $this->created $created;
  90.     }
  91.     public function getCreated(): \DateTime
  92.     {
  93.         return $this->created;
  94.     }
  95.     public function getReference(): int
  96.     {
  97.         return $this->reference;
  98.     }
  99.     public function setReference(int $reference): void
  100.     {
  101.         $this->reference $reference;
  102.     }
  103.     public function getDescription(): string
  104.     {
  105.         return $this->description;
  106.     }
  107.     public function setDescription(string $description): void
  108.     {
  109.         $this->description $description;
  110.     }
  111.     public function getRate(): int
  112.     {
  113.         return $this->rate;
  114.     }
  115.     public function setRate(int $rate): void
  116.     {
  117.         $this->rate $rate;
  118.     }
  119.     public function getCost(): int
  120.     {
  121.         return $this->cost;
  122.     }
  123.     public function setCost(int $cost): void
  124.     {
  125.         $this->cost $cost;
  126.     }
  127.     public function getProperty(): Property
  128.     {
  129.         return $this->property;
  130.     }
  131.     public function setProperty(Property $property): void
  132.     {
  133.         $this->property $property;
  134.     }
  135.     public function getStatementItem()
  136.     {
  137.         return $this->statementItem;
  138.     }
  139.     public function setStatementItem(Item $statementItem)
  140.     {
  141.         $this->statementItem $statementItem;
  142.     }
  143. }