mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-11-04 03:07:58 +00:00 
			
		
		
		
	Made user for UserAttribut optional
This commit is contained in:
		@@ -7,21 +7,37 @@ use App\Entity\UserInterface;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @author kevinfrantz
 | 
			
		||||
 *
 | 
			
		||||
 * @see UserAttributInterface
 | 
			
		||||
 */
 | 
			
		||||
trait UserAttribut
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var User
 | 
			
		||||
     * @var User|null
 | 
			
		||||
     */
 | 
			
		||||
    protected $user;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param UserInterface $user
 | 
			
		||||
     */
 | 
			
		||||
    public function setUser(UserInterface $user): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->user = $user;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return UserInterface
 | 
			
		||||
     */
 | 
			
		||||
    public function getUser(): UserInterface
 | 
			
		||||
    {
 | 
			
		||||
        return $this->user;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return bool
 | 
			
		||||
     */
 | 
			
		||||
    public function hasUser(): bool
 | 
			
		||||
    {
 | 
			
		||||
        return isset($this->user);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,18 @@ use App\Entity\UserInterface;
 | 
			
		||||
 */
 | 
			
		||||
interface UserAttributInterface
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @param UserInterface $user
 | 
			
		||||
     */
 | 
			
		||||
    public function setUser(UserInterface $user): void;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return UserInterface
 | 
			
		||||
     */
 | 
			
		||||
    public function getUser(): UserInterface;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return bool Returns if a user is set
 | 
			
		||||
     */
 | 
			
		||||
    public function hasUser(): bool;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user