src/Entity/Properties/Area.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Properties;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Symfony\Component\Validator\Constraints AS Assert;
  5. use Doctrine\ORM\Mapping AS ORM;
  6. use Ramsey\Uuid\Uuid;
  7. use Ramsey\Uuid\Lazy\LazyUuidFromString;
  8. use App\Entity\BaseEntity;
  9. /**
  10.  * @ORM\Entity(repositoryClass="App\Repository\Properties\AreaRepository")
  11.  * @ORM\Table(name="properties_area")
  12.  * @ORM\HasLifecycleCallbacks()
  13.  */
  14. class Area extends BaseEntity
  15. {
  16.     /**
  17.     * @ORM\Id
  18.     * @ORM\GeneratedValue(strategy="AUTO")
  19.     * @ORM\Column(type="integer")
  20.     */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="uuid")
  24.      * @Assert\Uuid
  25.      */
  26.     protected $uuid;
  27.     /**
  28.      * @var \DateTime
  29.      *
  30.      * @ORM\Column(type="datetime", nullable=false)
  31.      * @Assert\Type("\DateTime")
  32.      */
  33.     private $created;
  34.     /**
  35.      * @ORM\Column(type="string", length=128, nullable=false)
  36.      * @Assert\NotBlank()
  37.      */
  38.     private $name;
  39.     /**
  40.      * @ORM\OneToMany(targetEntity=Property::class, mappedBy="area", cascade={"all"})
  41.      **/
  42.     private $properties;
  43.     public function __construct(array $defaults = array())
  44.     {
  45.         // Defaults
  46.         $this->setUuid(Uuid::uuid4());
  47.         $this->setCreated(new \DateTime());
  48.         parent::__construct($defaults);
  49.     }
  50.     public function __toString()
  51.     {
  52.         return $this->getName();
  53.     }
  54.     public function getId(): ?int
  55.     {
  56.         return $this->id;
  57.     }
  58.     public function getUuid(): LazyUuidFromString
  59.     {
  60.         return $this->uuid;
  61.     }
  62.     public function setUuid(LazyUuidFromString $uuid): void
  63.     {
  64.         $this->uuid $uuid;
  65.     }
  66.     public function setCreated(\DateTime $created): void
  67.     {
  68.         $this->created $created;
  69.     }
  70.     public function getCreated(): \DateTime
  71.     {
  72.         return $this->created;
  73.     }
  74.     public function getName(): string
  75.     {
  76.         return $this->name;
  77.     }
  78.     public function setName(string $name): void
  79.     {
  80.         $this->name $name;
  81.     }
  82. }