<?php
namespace App\Containers\CompanySection\EmployeeContainer\Entities;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\DBAL\Types\Types;
use Gedmo\Mapping\Annotation as Gedmo;
use App\Containers\CompanySection\EmployeeContainer\Entities\EmployeeEntity;
use App\Containers\CompanySection\EmployeeContainer\Data\Repositories\EmployeeOptionsRepository;
/**
* Настройки
*/
#[ORM\Entity(repositoryClass: EmployeeOptionsRepository::class)]
#[ORM\Table(name: '`company_employee_options`')]
class EmployeeOptionsEntity
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: Types::INTEGER)]
private ?int $id = null;
// Сотрудник
#[ORM\ManyToOne(targetEntity: EmployeeEntity::class)]
#[ORM\JoinColumn(name: 'employee_id', referencedColumnName: 'id', nullable: false)]
private EmployeeEntity $employee;
// Код
#[ORM\Column(type: Types::STRING, length: 255, nullable: false)]
private string $code;
// Значение
#[ORM\Column(type: Types::JSON, nullable: true)]
private ?string $value = null;
#[Gedmo\Timestampable(on: 'create')]
#[ORM\Column(type: Types::DATETIME_IMMUTABLE)]
protected $createdAt;
#[Gedmo\Timestampable(on: 'update')]
#[ORM\Column(type: Types::DATETIME_IMMUTABLE)]
protected $updatedAt;
public function getId()
{
return $this->id;
}
public function getEmployee()
{
return $this->employee;
}
public function setEmployee($employee)
{
$this->employee = $employee;
return $this;
}
public function getCode()
{
return $this->code;
}
public function setCode($code)
{
$this->code = $code;
return $this;
}
public function getValue()
{
return json_decode($this->value ?? '[]', true);
}
public function setValue($value)
{
$this->value = json_encode($value);
return $this;
}
}