. */ declare(strict_types=1); namespace App\Entity\Parts; use App\Entity\Attachments\CategoryAttachment; use App\Entity\Base\AbstractPartsContainingDBElement; use App\Entity\Base\AbstractStructuralDBElement; use App\Entity\Parameters\CategoryParameter; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; /** * Class AttachmentType. */ #[ORM\Entity(repositoryClass: 'App\Repository\Parts\CategoryRepository')] #[ORM\Table(name: '`categories`')] #[ORM\Index(name: 'category_idx_name', columns: ['name'])] #[ORM\Index(name: 'category_idx_parent_name', columns: ['parent_id', 'name'])] class Category extends AbstractPartsContainingDBElement { /** * @var Collection */ #[ORM\OneToMany(targetEntity: 'Category', mappedBy: 'parent')] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $children; #[ORM\ManyToOne(targetEntity: 'Category', inversedBy: 'children')] #[ORM\JoinColumn(name: 'parent_id')] protected ?AbstractStructuralDBElement $parent = null; /** * @var string */ #[Groups(['full', 'import'])] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $partname_hint = ''; /** * @var string */ #[Groups(['full', 'import'])] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $partname_regex = ''; /** * @var bool */ #[Groups(['full', 'import'])] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $disable_footprints = false; /** * @var bool */ #[Groups(['full', 'import'])] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $disable_manufacturers = false; /** * @var bool */ #[Groups(['full', 'import'])] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $disable_autodatasheets = false; /** * @var bool */ #[Groups(['full', 'import'])] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $disable_properties = false; /** * @var string */ #[Groups(['full', 'import'])] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $default_description = ''; /** * @var string */ #[Groups(['full', 'import'])] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $default_comment = ''; /** * @var Collection */ #[Assert\Valid] #[Groups(['full'])] #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\CategoryAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection */ #[Assert\Valid] #[Groups(['full'])] #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\CategoryParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; public function getPartnameHint(): string { return $this->partname_hint; } /** * @return Category */ public function setPartnameHint(string $partname_hint): self { $this->partname_hint = $partname_hint; return $this; } public function getPartnameRegex(): string { return $this->partname_regex; } /** * @return Category */ public function setPartnameRegex(string $partname_regex): self { $this->partname_regex = $partname_regex; return $this; } public function isDisableFootprints(): bool { return $this->disable_footprints; } /** * @return Category */ public function setDisableFootprints(bool $disable_footprints): self { $this->disable_footprints = $disable_footprints; return $this; } public function isDisableManufacturers(): bool { return $this->disable_manufacturers; } /** * @return Category */ public function setDisableManufacturers(bool $disable_manufacturers): self { $this->disable_manufacturers = $disable_manufacturers; return $this; } public function isDisableAutodatasheets(): bool { return $this->disable_autodatasheets; } /** * @return Category */ public function setDisableAutodatasheets(bool $disable_autodatasheets): self { $this->disable_autodatasheets = $disable_autodatasheets; return $this; } public function isDisableProperties(): bool { return $this->disable_properties; } /** * @return Category */ public function setDisableProperties(bool $disable_properties): self { $this->disable_properties = $disable_properties; return $this; } public function getDefaultDescription(): string { return $this->default_description; } /** * @return Category */ public function setDefaultDescription(string $default_description): self { $this->default_description = $default_description; return $this; } public function getDefaultComment(): string { return $this->default_comment; } /** * @return Category */ public function setDefaultComment(string $default_comment): self { $this->default_comment = $default_comment; return $this; } public function __construct() { parent::__construct(); $this->children = new \Doctrine\Common\Collections\ArrayCollection(); $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); } }