src/Entity/ScopedItems.php line 16

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.  * TODO Bu tablo ismini OwnerShip olarak degistir
  10.  * @ORM\Entity(repositoryClass=ScopedItemsRepository::class)
  11.  * @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."})
  12.  */
  13. class ScopedItems
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      * @Groups({
  20.      *     "scope.core",
  21.      *     "ownership@core"
  22.      * })
  23.      */
  24.     private $id;
  25.     /**
  26.      * @ORM\OneToMany(targetEntity=UserScopedItem::class, mappedBy="scoped_item")
  27.      */
  28.     private $userScopedItems;
  29.     /**
  30.      * @Groups({
  31.      *      "scope.core",
  32.      *      "ownership@core"
  33.      *  })
  34.      * @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."})
  35.      */
  36.     private $category;
  37.     /**
  38.      * @Groups({
  39.      *      "scope.core",
  40.      *      "ownership@core"
  41.      *  })
  42.      * @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."})
  43.      */
  44.     private $type;
  45.     /**
  46.      * @ORM\Column(type="string", length=255, nullable=true)
  47.      * @Groups({
  48.      *       "scope.core",
  49.      *       "ownership@core"
  50.      *   })
  51.      */
  52.     private $description;
  53.     public function __construct()
  54.     {
  55.         $this->userScopedItems = new ArrayCollection();
  56.     }
  57.     public function getId(): ?int
  58.     {
  59.         return $this->id;
  60.     }
  61.     /**
  62.      * @return Collection<int, UserScopedItem>
  63.      */
  64.     public function getUserScopedItems(): Collection
  65.     {
  66.         return $this->userScopedItems;
  67.     }
  68.     public function addUserScopedItem(UserScopedItem $userScopedItem): self
  69.     {
  70.         if (!$this->userScopedItems->contains($userScopedItem)) {
  71.             $this->userScopedItems[] = $userScopedItem;
  72.             $userScopedItem->setScopedItem($this);
  73.         }
  74.         return $this;
  75.     }
  76.     public function removeUserScopedItem(UserScopedItem $userScopedItem): self
  77.     {
  78.         if ($this->userScopedItems->removeElement($userScopedItem)) {
  79.             // set the owning side to null (unless already changed)
  80.             if ($userScopedItem->getScopedItem() === $this) {
  81.                 $userScopedItem->setScopedItem(null);
  82.             }
  83.         }
  84.         return $this;
  85.     }
  86.     public function getType(): ?string
  87.     {
  88.         return $this->type;
  89.     }
  90.     public function setType(?string $type): self
  91.     {
  92.         $this->type $type;
  93.         return $this;
  94.     }
  95.     public function getCategory(): ?string
  96.     {
  97.         return $this->category;
  98.     }
  99.     public function setCategory(?string $category): self
  100.     {
  101.         $this->category $category;
  102.         return $this;
  103.     }
  104.     public function getDescription(): ?string
  105.     {
  106.         return $this->description;
  107.     }
  108.     public function setDescription(?string $description): self
  109.     {
  110.         $this->description $description;
  111.         return $this;
  112.     }
  113. }