src/Containers/CompanySection/EmployeeContainer/Entities/EmployeeOptionsEntity.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Containers\CompanySection\EmployeeContainer\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\CompanySection\EmployeeContainer\Entities\EmployeeEntity;
  7. use App\Containers\CompanySection\EmployeeContainer\Data\Repositories\EmployeeOptionsRepository;
  8. /** 
  9.  * Настройки
  10. */
  11. #[ORM\Entity(repositoryClassEmployeeOptionsRepository::class)]
  12. #[ORM\Table(name'`company_employee_options`')]
  13. class EmployeeOptionsEntity
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column(typeTypes::INTEGER)]
  18.     private ?int $id null;
  19.     // Сотрудник
  20.     #[ORM\ManyToOne(targetEntityEmployeeEntity::class)]
  21.     #[ORM\JoinColumn(name'employee_id'referencedColumnName'id'nullablefalse)]
  22.     private EmployeeEntity $employee;
  23.     // Код
  24.     #[ORM\Column(typeTypes::STRINGlength255nullablefalse)]
  25.     private string $code;
  26.     // Значение
  27.     #[ORM\Column(typeTypes::JSONnullabletrue)]
  28.     private ?string $value null;
  29.     #[Gedmo\Timestampable(on'create')]
  30.     #[ORM\Column(typeTypes::DATETIME_IMMUTABLE)]
  31.     protected $createdAt;
  32.     #[Gedmo\Timestampable(on'update')]
  33.     #[ORM\Column(typeTypes::DATETIME_IMMUTABLE)]
  34.     protected $updatedAt;
  35.     public function getId()
  36.     {
  37.         return $this->id;
  38.     }
  39.     public function getEmployee()
  40.     {
  41.         return $this->employee;
  42.     }
  43.     public function setEmployee($employee)
  44.     {
  45.         $this->employee $employee;
  46.         return $this;
  47.     }
  48.     public function getCode()
  49.     {
  50.         return $this->code;
  51.     }
  52.     public function setCode($code)
  53.     {
  54.         $this->code $code;
  55.         return $this;
  56.     }
  57.     public function getValue()
  58.     {
  59.         return json_decode($this->value ?? '[]'true);
  60.     }
  61.     public function setValue($value)
  62.     {
  63.         $this->value json_encode($value);
  64.         return $this;
  65.     }
  66. }