<?php
namespace App\Entity;
use App\Repository\ScopedItemsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=ScopedItemsRepository::class)
* @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."})
*/
class ScopedItems
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({
* "scope.core"
* })
*/
private $id;
/**
* @ORM\OneToMany(targetEntity=UserScopedItem::class, mappedBy="scoped_item")
*/
private $userScopedItems;
/**
* @Groups({
* "scope.core"
* })
* @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."})
*/
private $category;
/**
* @Groups({
* "scope.core"
* })
* @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."})
*/
private $type;
public function __construct()
{
$this->userScopedItems = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return Collection<int, UserScopedItem>
*/
public function getUserScopedItems(): Collection
{
return $this->userScopedItems;
}
public function addUserScopedItem(UserScopedItem $userScopedItem): self
{
if (!$this->userScopedItems->contains($userScopedItem)) {
$this->userScopedItems[] = $userScopedItem;
$userScopedItem->setScopedItem($this);
}
return $this;
}
public function removeUserScopedItem(UserScopedItem $userScopedItem): self
{
if ($this->userScopedItems->removeElement($userScopedItem)) {
// set the owning side to null (unless already changed)
if ($userScopedItem->getScopedItem() === $this) {
$userScopedItem->setScopedItem(null);
}
}
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getCategory(): ?string
{
return $this->category;
}
public function setCategory(?string $category): self
{
$this->category = $category;
return $this;
}
}