src/Entity/Properties/PropertyFeature.php line 18

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. use App\Entity\Properties\Property;
  10. use App\Entity\Properties\Feature;
  11. /**
  12.  * @ORM\Entity(repositoryClass="App\Repository\Properties\PropertyFeatureRepository")
  13.  * @ORM\Table(name="properties_propertyfeature")
  14.  * @ORM\HasLifecycleCallbacks()
  15.  */
  16. class PropertyFeature 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\ManyToOne(targetEntity=Property::class, inversedBy="propertyFeatures")
  38.      * @ORM\JoinColumn(nullable=false)
  39.      * @Assert\NotNull
  40.      **/
  41.     private $property;
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity=Feature::class, inversedBy="propertyFeatures")
  44.      * @ORM\JoinColumn(nullable=false)
  45.      * @Assert\NotNull
  46.      **/
  47.     private $feature;
  48.     public function __construct(array $defaults = array())
  49.     {
  50.         // Defaults
  51.         $this->setUuid(Uuid::uuid4());
  52.         $this->setCreated(new \DateTime());
  53.         parent::__construct($defaults);
  54.     }
  55.     public function __toString()
  56.     {
  57.         return $this->getId();
  58.     }
  59.     public function getId(): ?int
  60.     {
  61.         return $this->id;
  62.     }
  63.     public function getUuid(): LazyUuidFromString
  64.     {
  65.         return $this->uuid;
  66.     }
  67.     public function setUuid(LazyUuidFromString $uuid): void
  68.     {
  69.         $this->uuid $uuid;
  70.     }
  71.     public function setCreated(\DateTime $created): void
  72.     {
  73.         $this->created $created;
  74.     }
  75.     public function getCreated(): \DateTime
  76.     {
  77.         return $this->created;
  78.     }
  79.     public function getProperty()
  80.     {
  81.         return $this->property;
  82.     }
  83.     public function setProperty(Property $property)
  84.     {
  85.         $this->property $property;
  86.     }
  87.     public function getFeature()
  88.     {
  89.         return $this->feature;
  90.     }
  91.     public function setFeature(Feature $feature)
  92.     {
  93.         $this->feature $feature;
  94.     }
  95. }