src/Domain/PropertyMatching/Adapters/Gateway/Doctrine/PropertyMatchingEntity.php line 22

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Domain\PropertyMatching\Adapters\Gateway\Doctrine;
  4. use App\Entity\Agent;
  5. use App\Entity\Property;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Gedmo\Mapping\Annotation as Gedmo;
  10. use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
  11. use Symfony\Component\Serializer\Annotation\Groups;
  12. use Symfony\Component\Uid\Ulid;
  13. /**
  14.  * @ORM\Entity(repositoryClass=DoctrineMatchingRepository::class)
  15.  * @ORM\Table(name="property_matching")
  16.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  17.  */
  18. class PropertyMatchingEntity
  19. {
  20.     use SoftDeleteableEntity;
  21.     /**
  22.      * @var string|null
  23.      *
  24.      * @ORM\Id()
  25.      * @ORM\Column(type="ulid", unique=true)
  26.      *
  27.      * @Groups({
  28.      *    "property:read","property:write","property:put",
  29.      *    "mandate:read",
  30.      *    "transaction-item:read"
  31.      * })
  32.      */
  33.     private ?string $uuid;
  34.     /**
  35.      * @var string|null
  36.      *
  37.      * @ORM\Column(name="matching_type", type="string", nullable=false)
  38.      */
  39.     private ?string $matchingType;
  40.     /**
  41.      * @var Property|null
  42.      *
  43.      * @ORM\ManyToOne(targetEntity=Property::class, inversedBy="matchingEntity")
  44.      */
  45.     private ?Property $property null;
  46.     /**
  47.      * @var Agent|null
  48.      *
  49.      * @ORM\ManyToOne(targetEntity=Agent::class)
  50.      */
  51.     private ?Agent $agent null;
  52.     /**
  53.      * @var \DateTimeInterface|null
  54.      *
  55.      * @ORM\Column(name="created_at", type="datetime_immutable", nullable=false)
  56.      */
  57.     private ?\DateTimeInterface $createdAt;
  58.     /**
  59.      * @var PropertyMatchingSpecEntity
  60.      *
  61.      * @ORM\OneToOne (targetEntity=PropertyMatchingSpecEntity::class, inversedBy="matching", cascade={"persist"})
  62.      * @ORM\JoinColumn(name="specs_uuid", referencedColumnName="uuid")
  63.      */
  64.     private PropertyMatchingSpecEntity $specs;
  65.     /**
  66.      * @var Collection<Property>
  67.      */
  68.     private Collection $properties;
  69.     public function __construct()
  70.     {
  71.         $this->properties = new ArrayCollection();
  72.         $this->uuid = (new Ulid())->toBase32();
  73.     }
  74.     /**
  75.      * @return string|null
  76.      */
  77.     public function getUuid(): ?string
  78.     {
  79.         return $this->uuid;
  80.     }
  81.     /**
  82.      * @param string|null $uuid
  83.      *
  84.      * @return $this
  85.      */
  86.     public function setUuid(?string $uuid): self
  87.     {
  88.         $this->uuid $uuid;
  89.         return $this;
  90.     }
  91.     /**
  92.      * @return string|null
  93.      */
  94.     public function getMatchingType(): ?string
  95.     {
  96.         return $this->matchingType;
  97.     }
  98.     /**
  99.      * @param string|null $matchingType
  100.      *
  101.      * @return $this
  102.      */
  103.     public function setMatchingType(?string $matchingType): self
  104.     {
  105.         $this->matchingType $matchingType;
  106.         return $this;
  107.     }
  108.     /**
  109.      * @return \DateTimeInterface|null
  110.      */
  111.     public function getCreatedAt(): ?\DateTimeInterface
  112.     {
  113.         return $this->createdAt;
  114.     }
  115.     /**
  116.      * @param \DateTimeInterface|null $createdAt
  117.      *
  118.      * @return $this
  119.      */
  120.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  121.     {
  122.         $this->createdAt $createdAt;
  123.         return $this;
  124.     }
  125.     /**
  126.      * @return PropertyMatchingSpecEntity
  127.      */
  128.     public function getSpecs(): PropertyMatchingSpecEntity
  129.     {
  130.         return $this->specs;
  131.     }
  132.     /**
  133.      * @param PropertyMatchingSpecEntity $specs
  134.      *
  135.      * @return $this
  136.      */
  137.     public function setSpecs(PropertyMatchingSpecEntity $specs): self
  138.     {
  139.         $this->specs $specs;
  140.         return $this;
  141.     }
  142.     /**
  143.      * @return Collection
  144.      */
  145.     public function getProperties(): Collection
  146.     {
  147.         return $this->properties;
  148.     }
  149.     /**
  150.      * @param Collection $properties
  151.      *
  152.      * @return $this
  153.      */
  154.     public function setProperties(Collection $properties): self
  155.     {
  156.         $this->properties $properties;
  157.         return $this;
  158.     }
  159.     /**
  160.      * @return Property|null
  161.      */
  162.     public function getProperty(): ?Property
  163.     {
  164.         return $this->property;
  165.     }
  166.     /**
  167.      * @param Property|null $property
  168.      *
  169.      * @return $this
  170.      */
  171.     public function setProperty(?Property $property): self
  172.     {
  173.         $this->property $property;
  174.         return $this;
  175.     }
  176.     /**
  177.      * @return Agent|null
  178.      */
  179.     public function getAgent(): ?Agent
  180.     {
  181.         return $this->agent;
  182.     }
  183.     /**
  184.      * @param Agent|null $agent
  185.      *
  186.      * @return $this
  187.      */
  188.     public function setAgent(?Agent $agent): self
  189.     {
  190.         $this->agent $agent;
  191.         return $this;
  192.     }
  193. }