<?phpnamespace App\Entity;use App\Repository\ShareTypeRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Gedmo\Blameable\Traits\BlameableEntity;use Gedmo\Timestampable\Traits\TimestampableEntity;#[ORM\Entity(repositoryClass: ShareTypeRepository::class)]class ShareType extends BaseKeyValue{ use BlameableEntity; //Hook blameable behavior. Updates createdBy, updatedBy fields use TimestampableEntity; //Hook timestampable behavior. Updates createdAt, updatedAt fields const ALL = 'ALL'; const NONE = 'NONE'; const FRIENDS = 'FRIENDS'; #[ORM\Id] #[ORM\GeneratedValue(strategy: "IDENTITY")] #[ORM\Column] private ?int $id = null; #[ORM\Column()] private ?int $sort = null; #[ORM\OneToMany(mappedBy: 'shareFavouriteProductsType', targetEntity: User::class)] private Collection $shareFavouriteProductUsers; #[ORM\OneToMany(mappedBy: 'shareShoppingType', targetEntity: User::class)] private Collection $shareShoppingUsers; public function __construct() { $this->shareFavouriteProductUsers = new ArrayCollection(); $this->shareShoppingUsers = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getSort(): ?int { return $this->sort; } public function setSort(int $sort): self { $this->sort = $sort; return $this; } /** * @return Collection<int, Product> */ public function getShareFavouriteProductUsers(): Collection { return $this->shareFavouriteProductUsers; } public function addShareFavouriteProductUser(User $user): self { if (!$this->shareFavouriteProductUsers->contains($user)) { $this->shareFavouriteProductUsers->add($user); $user->setShareFavouriteProductsType($this); } return $this; } public function removeShareFavouriteProductUser(User $user): self { if ($this->shareFavouriteProductUsers->removeElement($user)) { // set the owning side to null (unless already changed) if ($user->getShareFavouriteProductsType() === $this) { $user->setShareFavouriteProductsType(null); } } return $this; } /** * @return Collection<int, User> */ public function getShareShoppingUsers(): Collection { return $this->shareShoppingUsers; } public function addShareShoppingUser(User $user): self { if (!$this->shareShoppingUsers->contains($user)) { $this->shareShoppingUsers->add($user); $user->setShareShoppingType($this); } return $this; } public function removeShareShoppingUser(User $user): self { if ($this->shareShoppingUsers->removeElement($user)) { // set the owning side to null (unless already changed) if ($user->getShareShoppingType() === $this) { $user->setShareShoppingType(null); } } return $this; }}