src/Entity/Label.php line 78
<?phpdeclare(strict_types=1);namespace App\Entity;use ApiPlatform\Core\Annotation\ApiResource;use ApiPlatform\Core\Annotation\ApiSubresource;use App\Controller\Api\Action\Label\LabelDeleteAction;use App\Controller\Api\Action\Label\LabelDuplicateAction;use App\Controller\Api\Action\Label\LabelToChildAction;use App\Controller\Api\Action\Label\LabelCollectionGetAction;use App\Controller\Api\Action\Label\LabelOnProjectAction;use App\Controller\Api\Action\Label\LabelOnItemAction;use App\Controller\Api\Action\Label\LabelToParentAction;use App\Repository\LabelRepository;use DateTime;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: LabelRepository::class)]#[ORM\Table(name: 'label')]#[ApiResource(collectionOperations: ['post' => ['validation_groups' => ['create']],'get' => ['controller' => LabelCollectionGetAction::class]],itemOperations: ['get','put','delete' => ['access_control' => 'is_granted("ROLE_USER")','controller' => LabelDeleteAction::class],'duplicate' => ['access_control' => 'is_granted("ROLE_USER")','controller' => LabelDuplicateAction::class,'method' => 'POST','path' => '/labels/duplicate/{id}'],'to_child' => ['access_control' => 'is_granted("ROLE_USER")','controller' => LabelToChildAction::class,'method' => 'POST','path' => '/labels/to-child/{id}'],'on_projects' => ['access_control' => 'is_granted("ROLE_USER")','controller' => LabelOnProjectAction::class,'method' => 'GET','path' => '/labels/{id}/on-projects'],'on_items' => ['access_control' => 'is_granted("ROLE_USER")','controller' => LabelOnItemAction::class,'method' => 'GET','path' => '/labels/{id}/on-project/{project}'],'to_parent' => ['access_control' => 'is_granted("ROLE_USER")','controller' => LabelToParentAction::class,'method' => 'PUT','path' => '/labels/to-parent/{id}']])]class Label implements CollectionItemInterface{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column(type: 'integer')]private ?int $id = null;#[ORM\Column(name: 'date_created',type: 'datetime',nullable: true)]private ?DateTime $dateCreated = null;#[ORM\Column(name: 'date_changed',type: 'datetime',nullable: true)]private ?DateTime $dateChanged = null;#[ORM\Column(name: 'color',type: 'string',length: 191,nullable: true)]#[Assert\NotBlank(groups: ['action'])]#[Assert\Length(max: 100,groups: ['action'])]private ?string $color = null;#[ORM\ManyToOne(targetEntity: User::class,cascade: ['persist'])]#[ORM\JoinColumn(name: 'user_created')]private ?User $userCreated = null;#[ORM\ManyToOne(targetEntity: User::class,cascade: ['persist'])]#[ORM\JoinColumn(name: 'user_changed')]private ?User $userChanged = null;#[ORM\Column(name: 'active',type: 'boolean',options: ['default' => true])]private bool $active = true;#[ORM\Column(name: 'name',type: 'string',length: 181,nullable: true)]#[Assert\NotBlank(groups: ['create'])]private ?string $name = null;#[ORM\Column(name: 'sequence',type: 'integer',nullable: true)]private ?int $sequence = null;#[ORM\Column(name: 'description',type: 'text',nullable: true)]private ?string $description = null;#[ORM\ManyToOne(targetEntity: Institution::class,cascade: ['persist'])]#[ORM\JoinColumn(name: 'institution')]#[ApiSubresource]private ?Institution $institution = null;#[ORM\ManyToOne(targetEntity: Label::class,cascade: ['persist'],inversedBy: 'children')]#[ORM\JoinColumn(name: 'parent',nullable: true,onDelete: 'CASCADE')]#[ApiSubresource]private ?Label $parent = null;#[ORM\OneToMany(mappedBy: 'label',targetEntity: ItemLabel::class,cascade: ['persist'],fetch: 'EXTRA_LAZY',orphanRemoval: true)]private iterable $itemLabel;#[ORM\OneToMany(mappedBy: 'parent',targetEntity: Label::class,cascade: ['persist', 'remove'],fetch: 'EXTRA_LAZY',orphanRemoval: true)]private ?iterable $children;public function __construct(){$this->itemLabel = new ArrayCollection();$this->children = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function setId(?int $id): self{$this->id = $id;return $this;}public function getDateCreated(): ?DateTime{return $this->dateCreated;}public function setDateCreated(?DateTime $dateCreated): self{$this->dateCreated = $dateCreated;return $this;}public function getDateChanged(): ?DateTime{return $this->dateChanged;}public function setDateChanged(?DateTime $dateChanged): self{$this->dateChanged = $dateChanged;return $this;}public function getUserCreated(): ?User{return $this->userCreated;}public function setUserCreated(?User $userCreated): self{$this->userCreated = $userCreated;return $this;}public function getUserChanged(): ?User{return $this->userChanged;}public function setUserChanged(?User $userChanged): self{$this->userChanged = $userChanged;return $this;}public function isActive(): bool{return $this->active;}public function setActive(bool $active): self{$this->active = $active;return $this;}public function getName(): ?string{return $this->name;}public function setName(?string $name): self{$this->name = $name;return $this;}public function getSequence(): ?int{return $this->sequence;}public function setSequence(?int $sequence): self{$this->sequence = $sequence;return $this;}public function getDescription(): ?string{return $this->description;}public function setDescription(?string $description): self{$this->description = $description;return $this;}public function getColor(): ?string{return $this->color;}public function setColor(?string $color): self{$this->color = $color;return $this;}public function getInstitution(): ?Institution{return $this->institution;}public function setInstitution(?Institution $institution): self{$this->institution = $institution;return $this;}public function getItemLabel(): iterable{return $this->itemLabel;}public function setItemLabel($itemLabel): self{$this->itemLabel = $itemLabel;return $this;}public function getParent(): ?Label{return $this->parent;}public function setParent(?Label $parent): self{$this->parent = $parent;return $this;}public function getChildren(): ?iterable{return $this->children;}}