Reputation: 1
I'm following the symofny documentation to creating the login system but when I try to create a a form to create a new user I get this error, I've been looking for a solution for nothing seems to work.
FatalErrorException: Error: Call to a member function toArray() on a non-object in var/www/Frigorifico/src/Frigorifico/FrigorificoBundle/Entity/Users.php line 90
private $roles;
public function ___construct()
{
$this->roles = new ArrayCollection();
}
public function getRoles()
{
return $this->roles->toArray();
}
Upvotes: 0
Views: 479
Reputation: 7428
you should not use:
public function ___construct()
{
$this->roles = new ArrayCollection();
}
but:
public function __construct()
{
$this->roles = new ArrayCollection();
}
see more at official php documenation
Upvotes: 1