<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\JobsLibRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\MaxDepth;
use ApiPlatform\Core\Annotation\ApiProperty;
#[ORM\Entity(repositoryClass: JobsLibRepository::class)]
#[ApiResource(
normalizationContext: ['groups' => ['job_lib:read']],
denormalizationContext: ['groups' => ['job_lib:write']],
order: ['id' => 'DESC'],
)]
#[ApiFilter(SearchFilter::class, properties: [
'name' => 'ipartial',
'code1c' => 'exact',
])]
class JobsLib
{
#[Groups(['job_lib:read', 'job_lib:write','job:read', 'job:write', 'worker:read', 'worker:write', 'account_worker:read', 'account:read', 'read', 'account:write'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[Groups(['job_lib:read', 'job_lib:write','job:read', 'job:write', 'worker:read', 'worker:write', 'account_worker:read', 'account:read', 'read', 'account:write'])]
#[ORM\Column(length: 255, nullable: true)]
private ?string $name = null;
#[Groups(['job_lib:read', 'job_lib:write','job:read', 'job:write', 'worker:read', 'worker:write', 'account_worker:read', 'account:read', 'read', 'account:write'])]
#[ORM\Column(length: 255, nullable: true)]
private ?string $description = null;
#[Groups(['job_lib:read', 'job_lib:write','job:read', 'job:write', 'worker:read', 'worker:write', 'account_worker:read', 'account:read', 'read', 'account:write'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $code1c = null;
#[Groups(['job_lib:read', 'job_lib:write','job:read', 'job:write', 'worker:read', 'worker:write', 'account_worker:read', 'account:read', 'read', 'account:write'])]
#[ORM\ManyToMany(targetEntity: AccountJobsList::class, inversedBy: 'jobsLibs')]
private Collection $accountJobsList;
public function __construct()
{
$this->accountJobsList = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getCode1c(): ?string
{
return $this->code1c;
}
public function setCode1c(?string $code1c): self
{
$this->code1c = $code1c;
return $this;
}
/**
* @return Collection<int, AccountJobsList>
*/
public function getAccountJobsList(): Collection
{
return $this->accountJobsList;
}
public function addAccountJobsList(AccountJobsList $accountJobsList): self
{
if (!$this->accountJobsList->contains($accountJobsList)) {
$this->accountJobsList->add($accountJobsList);
}
return $this;
}
public function removeAccountJobsList(AccountJobsList $accountJobsList): self
{
$this->accountJobsList->removeElement($accountJobsList);
return $this;
}
}