src/Containers/CrmSection/ClientContainer/Entities/ClientOptionsEntity.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Containers\CrmSection\ClientContainer\Entities;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Doctrine\DBAL\Types\Types;
  5. use Gedmo\Mapping\Annotation as Gedmo;
  6. use App\Containers\CrmSection\ClientContainer\Entities\ClientEntity;
  7. use App\Containers\CrmSection\ClientContainer\Data\Repositories\ClientOptionsRepository;
  8. /** 
  9.  * Настройки
  10. */
  11. #[ORM\Entity(repositoryClassClientOptionsRepository::class)]
  12. #[ORM\Table(name'`crm_clients_options`')]
  13. #[ORM\Index(columns: ['code'], name'crm_clients_options_custom_idx')]
  14. class ClientOptionsEntity
  15. {
  16.     #[ORM\Id]
  17.     #[ORM\GeneratedValue]
  18.     #[ORM\Column(typeTypes::INTEGER)]
  19.     private ?int $id null;
  20.     // Клиент
  21.     #[ORM\ManyToOne(targetEntityClientEntity::class)]
  22.     #[ORM\JoinColumn(name'client_id'referencedColumnName'id'nullablefalse)]
  23.     private ClientEntity $client;
  24.     // Код
  25.     #[ORM\Column(typeTypes::STRINGlength255nullablefalse)]
  26.     private string $code;
  27.     // Значение
  28.     #[ORM\Column(typeTypes::JSONnullabletrue)]
  29.     private ?string $value null;
  30.     #[Gedmo\Timestampable(on'create')]
  31.     #[ORM\Column(typeTypes::DATETIME_IMMUTABLE)]
  32.     protected $createdAt;
  33.     #[Gedmo\Timestampable(on'update')]
  34.     #[ORM\Column(typeTypes::DATETIME_IMMUTABLE)]
  35.     protected $updatedAt;
  36.     public function getId()
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getClient()
  41.     {
  42.         return $this->client;
  43.     }
  44.     public function setClient($client)
  45.     {
  46.         $this->client $client;
  47.         return $this;
  48.     }
  49.     public function getCode()
  50.     {
  51.         return $this->code;
  52.     }
  53.     public function setCode($code)
  54.     {
  55.         $this->code $code;
  56.         return $this;
  57.     }
  58.     public function getValue()
  59.     {
  60.         return json_decode($this->value ?? '[]'true);
  61.     }
  62.     public function setValue($value)
  63.     {
  64.         $this->value json_encode($value);
  65.         return $this;
  66.     }
  67. }