This is the very first time I use Symfony2 by myself and I think I've made a mistake when configuring the FOS User Bundle. Looks like my User entity does not properly extend the FOS\UserBundle\Entity\User.
Here's my User class (basically the same as mentioned on the doc)
<?php
// src/Acme/UserBundle/Entity/User.php
namespace VillaPrivee\UserBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Entity\User as BaseUser;
/**
* @ORM\Entity
* @ORM\Table(name="user")
*/
class User extends BaseUser
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
public function __construct()
{
parent::__construct();
// your own logic
}
}
Since I use Netbeans, I'm able to "Ctrl click" and make sure "FOS\UserBundle\Entity\User" exists. So far, I don't see anything wrong...
But when I try to create a new user using my terminal, I get this error:
Fatal error: Call to undefined method VillaPrivee\UserBundle\Entity\User::setUsername()
in /Applications/MAMP/htdocs/VillaPrivee/vendor/friendsofsymfony/
user-bundle/FOS/UserBundle/Util/UserManipulator.php on line 50
Not sure what other details I should provide you guys with, just let me know if any other file could matter in this case.
Thanks for your help!
Edit :
<?php
namespace VillaPrivee\UserBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class VillaPriveeUserBundle extends Bundle
{
public function getParent()
{
return 'FOSUserBundle';
}
}
config.yml:
fos_user:
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
firewall_name: main
user_class: VillaPrivee\UserBundle\Entity\User
FOSUserBundleregistered inAppKernel.php? - DonCallistoAppKernel.php? Moreover, why are you extendingFOSUserBundle? Are you going to manipulateFOSUserBundlecontrollers via override? - DonCallistoreturn 'FOSUserBundle'part intogetParent()method. Moreover with "include AppKernel.php" I mean if you can past it into your question :) - DonCallisto