| 
					
				 | 
			
			
				@@ -3,6 +3,8 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 namespace App\Entity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use App\Repository\UserRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use Doctrine\Common\Collections\ArrayCollection; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use Doctrine\Common\Collections\Collection; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use Doctrine\ORM\Mapping as ORM; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use Symfony\Component\Security\Core\User\UserInterface; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -36,6 +38,24 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     #[ORM\Column] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private ?string $password = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @var Collection<int, CommonList> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    #[ORM\OneToMany(targetEntity: CommonList::class, mappedBy: 'addedBy')] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private Collection $commonLists; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @var Collection<int, UserList> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    #[ORM\OneToMany(targetEntity: UserList::class, mappedBy: 'viewer', orphanRemoval: true)] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private Collection $userLists; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function __construct() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $this->commonLists = new ArrayCollection(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $this->userLists = new ArrayCollection(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public function getId(): ?int 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return $this->id; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -110,4 +130,64 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // If you store any temporary, sensitive data on the user, clear it here 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // $this->plainPassword = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return Collection<int, CommonList> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function getCommonLists(): Collection 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return $this->commonLists; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function addCommonList(CommonList $commonList): static 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!$this->commonLists->contains($commonList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $this->commonLists->add($commonList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $commonList->setAddedBy($this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return $this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function removeCommonList(CommonList $commonList): static 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ($this->commonLists->removeElement($commonList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // set the owning side to null (unless already changed) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ($commonList->getAddedBy() === $this) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $commonList->setAddedBy(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return $this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return Collection<int, UserList> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function getUserLists(): Collection 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return $this->userLists; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function addUserList(UserList $userList): static 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!$this->userLists->contains($userList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $this->userLists->add($userList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $userList->setViewer($this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return $this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function removeUserList(UserList $userList): static 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ($this->userLists->removeElement($userList)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // set the owning side to null (unless already changed) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ($userList->getViewer() === $this) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $userList->setViewer(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return $this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |