Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
20 / 20
CRAP
100.00% covered (success)
100.00%
34 / 34
Usertodo
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
20 / 20
31
100.00% covered (success)
100.00%
34 / 34
 __construct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
3 / 3
 getId
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 getUsername
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 setUsername
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getSalt
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getPassword
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 setPassword
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getEmail
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 setEmail
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getRole
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 setRole
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getRoles
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 eraseCredentials
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getTasktodos
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 addTasktodo
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
4 / 4
 removeTasktodo
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
4 / 4
 getCreatedAt
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 setCreatedAt
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getFreshDate
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 setFreshDate
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
2 / 2
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
 * @ORM\Entity(repositoryClass="App\Repository\UsertodoRepository")
 * @UniqueEntity(
 *  fields= {"email"},
 *  message= "Cet email est déjà utilisé"
 * )
 * @UniqueEntity(
 *  fields={"username"},
 *  message="Ce nom est déjà pris"
 * )
 */
class Usertodo implements UserInterface
{
    /**
     * @ORM\Column(type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue()
     */
    private $id;
    /**
     * @ORM\Column(type="string", length=25, unique=true)
     * @Assert\NotBlank(message="Vous devez saisir un nom d'utilisateur.")
     * @Assert\Length(
     *      min=4, 
     *      max=50, 
     *      minMessage="Nom trop court", 
     *      maxMessage = "Nom trop long"
     * )
     */
    private $username;
    /**
     * @ORM\Column(type="string", length=64)
     * @Assert\Length(
     *      min=8,
     *      minMessage="Le mot de passe doit comporter au moins 8 caractères"
     * )
     */
    private $password;
    /**
     * @ORM\Column(type="string", length=60, unique=true)
     * @Assert\NotBlank(message="Vous devez saisir une adresse email.")
     * @Assert\Email(message="Le format de l'adresse n'est pas correcte.")
     */
    private $email;
    /**
     * @ORM\Column(type="datetime")
     */
    private $createdAt;
    /**
     * @ORM\Column(type="datetime", nullable=true)
     */
    private $freshDate;
    /**
     * @ORM\OneToMany(targetEntity="App\Entity\Tasktodo", mappedBy="usertodo", orphanRemoval=true, cascade={"persist", "remove"})
     */
    private $tasktodos;
    /**
     * @ORM\Column(type="string", length=80)
     */
    private $role;
    public function __construct()
    {
        $this->createdAt = new \Datetime();
        $this->tasktodos = new ArrayCollection();
    }
    public function getId(): ?int
    {
        return $this->id;
    }
    public function getUsername(): ?string
    {
        return $this->username;
    }
    public function setUsername(string $username)
    {
        $this->username = $username;
        return $this;
    }
    public function getSalt()
    {
        return null;
    }
    public function getPassword(): ?string
    {
        return $this->password;
    }
    public function setPassword(string $password)
    {
        $this->password = $password;
        return $this;
    }
    public function getEmail(): ?string
    {
        return $this->email;
    }
    public function setEmail(string $email)
    {
        $this->email = $email;
        return $this;
    }
    public function getRole(): ?string
    {
        return $this->role;
    }
    public function setRole(string $role): self
    {
        $this->role = $role;
    
        return $this;
    }
    public function getRoles()
    {
        return [$this->getRole()];
    }
    public function eraseCredentials()
    {
        return null;
    }
    /**
     * @return Collection|Tasktodo[]
     */
    public function getTasktodos(): Collection
    {
        return $this->tasktodos;
    }
    public function addTasktodo(Tasktodo $tasktodo): self
    {
        if (!$this->tasktodos->contains($tasktodo)) {
            $this->tasktodos[] = $tasktodo;
            $tasktodo->setUsertodo($this);
        }
        return $this;
    }
    public function removeTasktodo(Tasktodo $tasktodo): self
    {
        if ($this->tasktodos->removeElement($tasktodo)) {
            // set the owning side to null (unless already changed)
            if ($tasktodo->getUsertodo() === $this) {
                $tasktodo->setUsertodo(null);
            }
        }
        return $this;
    }
    public function getCreatedAt(): ?\DateTimeInterface
    {
        return $this->createdAt;
    }
    public function setCreatedAt(\DateTimeInterface $createdAt): self
    {
        $this->createdAt = $createdAt;
        return $this;
    }
    public function getFreshDate(): ?\DateTimeInterface
    {
        return $this->freshDate;
    }
    public function setFreshDate(?\DateTimeInterface $freshDate): self
    {
        $this->freshDate = $freshDate;
        return $this;
    }
}