src/Entity/ScopedItems.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ScopedItemsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ScopedItemsRepository::class)
  10.  * @ORM\Table(name="scoped_items", options={"comment":"This table stores items scoped by users. Some items are globally visible, while others are restricted to the user who created them. The visibility of items is controlled by predefined rules to ensure privacy and control over the lists."})
  11.  */
  12. class ScopedItems
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      * @Groups({
  19.      *     "scope.core"
  20.      * })
  21.      */
  22.     private $id;
  23.     /**
  24.      * @ORM\OneToMany(targetEntity=UserScopedItem::class, mappedBy="scoped_item")
  25.      */
  26.     private $userScopedItems;
  27.     /**
  28.      * @Groups({
  29.      *       "scope.core"
  30.      *   })
  31.      * @ORM\Column(type="string", length=64, nullable=true, options={"comment":"This field stores the category of the item. (Project, Order, User...) This is user based and can be different for each user. for defined user show only owned items."})
  32.      */
  33.     private $category;
  34.     /**
  35.      * @Groups({
  36.      *       "scope.core"
  37.      *   })
  38.      * @ORM\Column(type="string", length=64, nullable=true, options={"comment":"This field stores the type of the item. (List, chart, profit ) This is user based and can be different for each user. for defined user show only owned items."})
  39.      */
  40.     private $type;
  41.     public function __construct()
  42.     {
  43.         $this->userScopedItems = new ArrayCollection();
  44.     }
  45.     public function getId(): ?int
  46.     {
  47.         return $this->id;
  48.     }
  49.     /**
  50.      * @return Collection<int, UserScopedItem>
  51.      */
  52.     public function getUserScopedItems(): Collection
  53.     {
  54.         return $this->userScopedItems;
  55.     }
  56.     public function addUserScopedItem(UserScopedItem $userScopedItem): self
  57.     {
  58.         if (!$this->userScopedItems->contains($userScopedItem)) {
  59.             $this->userScopedItems[] = $userScopedItem;
  60.             $userScopedItem->setScopedItem($this);
  61.         }
  62.         return $this;
  63.     }
  64.     public function removeUserScopedItem(UserScopedItem $userScopedItem): self
  65.     {
  66.         if ($this->userScopedItems->removeElement($userScopedItem)) {
  67.             // set the owning side to null (unless already changed)
  68.             if ($userScopedItem->getScopedItem() === $this) {
  69.                 $userScopedItem->setScopedItem(null);
  70.             }
  71.         }
  72.         return $this;
  73.     }
  74.     public function getType(): ?string
  75.     {
  76.         return $this->type;
  77.     }
  78.     public function setType(?string $type): self
  79.     {
  80.         $this->type $type;
  81.         return $this;
  82.     }
  83.     public function getCategory(): ?string
  84.     {
  85.         return $this->category;
  86.     }
  87.     public function setCategory(?string $category): self
  88.     {
  89.         $this->category $category;
  90.         return $this;
  91.     }
  92. }