src/Entity/Common/Contact.php line 15

  1. <?php
  2. namespace App\Entity\Common;
  3. use App\Entity\Traits\TrackerFields;
  4. use App\Entity\Traits\UserCreatedInterface;
  5. use App\Entity\Traits\UserUpdatedInterface;
  6. use App\Model\Common\HaveOwnerInterface;
  7. use App\Model\Common\OwnerInterface;
  8. use Doctrine\ORM\Mapping as ORM;
  9. #[ORM\Table(name'contacts')]
  10. #[ORM\Entity(repositoryClass'App\Repository\Common\ContactRepository')]
  11. #[ORM\HasLifecycleCallbacks]
  12. class Contact implements UserCreatedInterfaceUserUpdatedInterfaceHaveOwnerInterface
  13. {
  14.     use TrackerFields;
  15.     public const TYPE_PHONE 'phone';
  16.     public const TYPE_EMAIL 'email';
  17.     public const TYPE_SITE 'site';
  18. //    const TYPE_OTHER = 'other';
  19.     /**
  20.      * @var int|null
  21.      */
  22.     #[ORM\Id]
  23.     #[ORM\GeneratedValue(strategy'AUTO')]
  24.     #[ORM\Column(type'integer')]
  25.     private $id;
  26.     /**
  27.      * @var string|null
  28.      */
  29.     #[ORM\Column(type'string'nullabletrue)]
  30.     private $type;
  31.     /**
  32.      * @var string|null
  33.      */
  34.     #[ORM\Column(type'string')]
  35.     private $caption;
  36.     /**
  37.      * @var string|null
  38.      */
  39.     #[ORM\Column(type'string')]
  40.     private $value;
  41.     /**
  42.      * @var Owner
  43.      */
  44.     #[ORM\Embedded(class: 'App\Entity\Common\Owner')]
  45.     private $owner;
  46.     public function __construct()
  47.     {
  48.         $this->owner = new Owner();
  49.     }
  50.     public static function getTypes()
  51.     {
  52.         return [self::TYPE_PHONEself::TYPE_EMAILself::TYPE_SITE/*self::TYPE_OTHER*/];
  53.     }
  54.     /**
  55.      * @return int|null
  56.      */
  57.     public function getId(): ?int
  58.     {
  59.         return $this->id;
  60.     }
  61.     /**
  62.      * @param int|null $id
  63.      */
  64.     public function setId(?int $id): void
  65.     {
  66.         $this->id $id;
  67.     }
  68.     /**
  69.      * @return string|null
  70.      */
  71.     public function getType(): ?string
  72.     {
  73.         return $this->type;
  74.     }
  75.     /**
  76.      * @param string|null $type
  77.      */
  78.     public function setType(?string $type): void
  79.     {
  80.         $this->type $type;
  81.     }
  82.     /**
  83.      * @return string|null
  84.      */
  85.     public function getCaption(): ?string
  86.     {
  87.         return $this->caption;
  88.     }
  89.     /**
  90.      * @param string|null $caption
  91.      */
  92.     public function setCaption(?string $caption): void
  93.     {
  94.         $this->caption $caption;
  95.     }
  96.     /**
  97.      * @return string|null
  98.      */
  99.     public function getValue(): ?string
  100.     {
  101.         return $this->value;
  102.     }
  103.     /**
  104.      * @param string|null $value
  105.      */
  106.     public function setValue(?string $value): void
  107.     {
  108.         $this->value $value;
  109.     }
  110.     /**
  111.      * @return Owner
  112.      */
  113.     public function getOwner(): OwnerInterface
  114.     {
  115.         return $this->owner;
  116.     }
  117.     /**
  118.      * @param Owner $owner
  119.      */
  120.     public function setOwner(Owner $owner): void
  121.     {
  122.         $this->owner $owner;
  123.     }
  124. }