symfony - FOS UserBundle -> Unable to create new user -
this first time use symfony2 myself , think i've made mistake when configuring fos user bundle. looks user entity not extend fos\userbundle\entity\user.
here's user class (basically same mentioned on doc)
<?php // src/acme/userbundle/entity/user.php namespace villaprivee\userbundle\entity; use doctrine\orm\mapping orm; use fos\userbundle\entity\user 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(); // own logic } }
since use netbeans, i'm able "ctrl click" , make sure "fos\userbundle\entity\user" exists. far, don't see wrong...
but when try create new user using terminal, error:
fatal error: call 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 other details should provide guys with, let me know if other file matter in case.
thanks 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 'mongodb', 'couchdb' , 'propel' firewall_name: main user_class: villaprivee\userbundle\entity\user
i think extend wrong class, try with:
use fos\userbundle\model\user baseuser;
edit:
yep, extending fos\userbundle\entity\user
deprecated, extend fos\userbundle\model\user directly.
documentation
Comments
Post a Comment