<?phpnamespace App\Entity;use App\Repository\BlogPostCategoryOrderRepository;use Doctrine\ORM\Mapping as ORM;use App\Entity\Instance;use App\Entity\SubDomain;use App\Entity\BlogPostCategory;/** * @ORM\Entity(repositoryClass=BlogPostCategoryOrderRepository::class) * @ORM\Table( * name="blog_post_category_order", * uniqueConstraints={ * @ORM\UniqueConstraint(columns={"instance_id", "sub_domain_id", "category_id"}) * } * ) */class BlogPostCategoryOrder{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity=Instance::class) * @ORM\JoinColumn(nullable=false, onDelete="CASCADE") */ private $instance; /** * @ORM\ManyToOne(targetEntity=SubDomain::class) * @ORM\JoinColumn(nullable=false, onDelete="CASCADE") */ private $subDomain; /** * @ORM\ManyToOne(targetEntity=BlogPostCategory::class) * @ORM\JoinColumn(nullable=false, onDelete="CASCADE") */ private $category; /** * @ORM\Column(type="integer") */ private $position = 0; public function getId(): ?int { return $this->id; } public function getInstance(): ?Instance { return $this->instance; } public function setInstance(?Instance $instance): self { $this->instance = $instance; return $this; } public function getSubDomain(): ?SubDomain { return $this->subDomain; } public function setSubDomain(?SubDomain $subDomain): self { $this->subDomain = $subDomain; return $this; } public function getCategory(): ?BlogPostCategory { return $this->category; } public function setCategory(?BlogPostCategory $category): self { $this->category = $category; return $this; } public function getPosition(): int { return (int) $this->position; } public function setPosition(int $position): self { $this->position = $position; return $this; } public function __toString(): string { // Utile si tu affiches l’entité dans un select EasyAdmin $parts = []; if ($this->instance) { $parts[] = (string) $this->instance; } if ($this->subDomain) { $parts[] = (string) $this->subDomain; } if ($this->category) { $parts[] = (string) $this->category; } return implode(' / ', $parts) ?: 'Ordre rubrique'; }}