<?php
namespace App\Entity\Maintenance;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints AS Constraints;
use Symfony\Component\Validator\Constraints AS Assert;
use Doctrine\ORM\Mapping AS ORM;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\Lazy\LazyUuidFromString;
use App\Entity\BaseEntity;
use App\Entity\Properties\Property;
use App\Entity\Statements\Item;
/**
* @ORM\Entity(repositoryClass="App\Repository\Maintenance\MaintenanceRepository")
* @ORM\Table(name="maintenance_maintenance")
*/
class Maintenance extends BaseEntity
{
/**
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="uuid")
* @Assert\Uuid
*/
protected $uuid;
/**
* @var \DateTime
*
* @ORM\Column(type="datetime", nullable=false)
* @Assert\Type("\DateTime")
*/
private $created;
/**
* @ORM\Column(type="integer", nullable=false)
*/
private $reference;
/**
* @ORM\Column(type="string", nullable=false, length="250")
*/
private $description;
/**
* @ORM\Column(type="integer", nullable=false, length="10")
*/
private $rate;
/**
* @ORM\Column(type="integer", nullable=false, length="10")
*/
private $cost;
/**
* @ORM\ManyToOne(targetEntity=Property::class, inversedBy="maintenance")
* @ORM\JoinColumn(nullable=false)
**/
private $property;
/**
* @ORM\OneToOne(targetEntity=Item::class, mappedBy="maintenance")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
**/
private $statementItem;
public function __construct(array $defaults = array())
{
// Defaults
$this->setUuid(Uuid::uuid4());
$this->setCreated(new \DateTime());
$this->rate = 0;
$this->cost = 0;
parent::__construct($defaults);
}
public function __toString()
{
return $this->getId();
}
public function getId(): ?int
{
return $this->id;
}
public function getUuid(): LazyUuidFromString
{
return $this->uuid;
}
public function setUuid(LazyUuidFromString $uuid): void
{
$this->uuid = $uuid;
}
public function setCreated(\DateTime $created): void
{
$this->created = $created;
}
public function getCreated(): \DateTime
{
return $this->created;
}
public function getReference(): int
{
return $this->reference;
}
public function setReference(int $reference): void
{
$this->reference = $reference;
}
public function getDescription(): string
{
return $this->description;
}
public function setDescription(string $description): void
{
$this->description = $description;
}
public function getRate(): int
{
return $this->rate;
}
public function setRate(int $rate): void
{
$this->rate = $rate;
}
public function getCost(): int
{
return $this->cost;
}
public function setCost(int $cost): void
{
$this->cost = $cost;
}
public function getProperty(): Property
{
return $this->property;
}
public function setProperty(Property $property): void
{
$this->property = $property;
}
public function getStatementItem()
{
return $this->statementItem;
}
public function setStatementItem(Item $statementItem)
{
$this->statementItem = $statementItem;
}
}