Commit 5d012b69 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

AbstractUser::$roles est une Collection, pas un array.

parent cd715162
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ namespace UnicaenAuth\Entity\Db;

use BjyAuthorize\Provider\Role\ProviderInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use ZfcUser\Entity\UserInterface;

@@ -53,7 +54,7 @@ abstract class AbstractUser implements UserInterface, ProviderInterface
    protected $state;

    /**
     * @var \Doctrine\Common\Collections\Collection
     * @var Collection
     * @ORM\ManyToMany(targetEntity="UnicaenAuth\Entity\Db\Role")
     * @ORM\JoinTable(name="user_role_linker",
     *      joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")},
@@ -205,11 +206,11 @@ abstract class AbstractUser implements UserInterface, ProviderInterface
    /**
     * Get role.
     *
     * @return array
     * @return Collection
     */
    public function getRoles()
    {
        return $this->roles->getValues();
        return $this->roles;
    }

    /**
@@ -219,9 +220,9 @@ abstract class AbstractUser implements UserInterface, ProviderInterface
     *
     * @return void
     */
    public function addRole($role)
    public function addRole(Role $role)
    {
        $this->roles[] = $role;
        $this->roles->add($role);
    }
    
    /**