0

i had install SontaUserBundle i follow the document n i created

now what i want to add oneToMany relationship inside user class

/**
 * Application\Sonata\UserBundle\Entity\User;
 * @ORM\Table(name="fos_user")
 * @ORM\Entity
 */
class User extends BaseUser{

    /**
     * @var integer $id
     */

    protected $id;


    /**
     * @ORM\OneToMany(targetEntity="\Bansri\AssetBundle\Entity\statusQues", mappedBy="user")
     */
    protected $statusQues;


}

but when i am running

app/console doctrine:generate:entities ApplicationSonataUserBundle:User

it's not generate get and add functions and when i manually crated that get and add function its returning null

is somting wrong with my codes

Anil Gupta
  • 2,329
  • 4
  • 24
  • 30

1 Answers1

0

I suppose that

app/console  doctrine:generate:entities ApplicationSonataUserBundle:User

isn't the right cli-command.

Moreover, where are you adding that relationship? Looking at your code, seem that you write this directly into Sonata Bundle and this isn't correct.
There is a better (and "good practice oriented") way for do this and consist in create a new user class and extends BaseUser (pretty like you're doin' right now) but directly into your bundle.

Then, you have to run

app/console  doctrine:generate:entities YourBundleName
DonCallisto
  • 29,419
  • 9
  • 72
  • 100
  • i had override SonataUserBundle inside Application folder using SonataEasyExtendsBundle and i am written doctrine relation annotation there and this cli is working fine it only generate functions of property of that Bundle entities i.e User – Anil Gupta Jan 03 '13 at 11:05