src/V4/Model/ContactSpecificField/ContactSpecificField.php line 9

Open in your IDE?
  1. <?php
  2. namespace App\V4\Model\ContactSpecificField;
  3. use App\Model\Traits\ImportableObjectTrait;
  4. use App\V4\Model\Contact\Contact;
  5. use App\V4\Model\SpecificField\SpecificField;
  6. class ContactSpecificField extends SpecificField
  7. {
  8.     use ImportableObjectTrait;
  9.     private $contact;
  10.     public function __construct()
  11.     {
  12.         $this->setType('ContactSpecificField');
  13.     }
  14.     /**
  15.      * @return string|null
  16.      */
  17.     public function getContact(): ?string
  18.     {
  19.         if ($this->contact instanceof Contact && !empty($this->contact->getId())) {
  20.             return '/api/contacts/'.$this->contact->getId();
  21.         }
  22.         return null;
  23.     }
  24.     /**
  25.      * @return Contact|null
  26.      */
  27.     public function getContactObject(): ?Contact
  28.     {
  29.         return $this->contact;
  30.     }
  31.     /**
  32.      * @param Contact|null $contact
  33.      *
  34.      * @return ContactSpecificField
  35.      */
  36.     public function setContact(?Contact $contact): ContactSpecificField
  37.     {
  38.         $this->contact $contact;
  39.         return $this;
  40.     }
  41. }