src/Entity/Profile.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProfileRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. #[ORM\Entity(repositoryClassProfileRepository::class)]
  9. class Profile
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column(type'integer')]
  14.     private $id;
  15.     #[Gedmo\Versioned]
  16.     #[ORM\Column(type'string'length64)]
  17.     #[Assert\NotBlank]
  18.     private ?string $name;
  19.     #[ORM\ManyToMany(targetEntityMenuItemAdmin::class, inversedBy'profiles')]
  20.     private $menuitems;
  21.     public function __construct()
  22.     {
  23.         $this->menuitems = new ArrayCollection();
  24.     }
  25.     public function getId(): ?int
  26.     {
  27.         return $this->id;
  28.     }
  29.     public function getName(): ?string
  30.     {
  31.         return $this->name;
  32.     }
  33.     public function setName(string $name): self
  34.     {
  35.         $this->name $name;
  36.         return $this;
  37.     }
  38.     /**
  39.      * @return Collection<int, MenuItemAdmin>
  40.      */
  41.     public function getMenuitems(): Collection
  42.     {
  43.         return $this->menuitems;
  44.     }
  45.     public function addMenuitem(MenuItemAdmin $menuitem): self
  46.     {
  47.         if (!$this->menuitems->contains($menuitem)) {
  48.             $this->menuitems[] = $menuitem;
  49.         }
  50.         return $this;
  51.     }
  52.     public function removeMenuitem(MenuItemAdmin $menuitem): self
  53.     {
  54.         $this->menuitems->removeElement($menuitem);
  55.         return $this;
  56.     }
  57.     public function __toString(): string
  58.     {
  59.         return $this->name;
  60.     }
  61. }