how to add where clause in formtype symfony2
its been days now that am looking for the 'how' of this problem. I just
learned symfony2 and i cant find a way to this, i've tried different stuff
found on the net but i could not get any to work.
Here is my problem, I have a form PictureType in which i include another
entity Collection (which is a collection of picture or if you prefer an
album of picture).
When the user uploads his picture he needs to select in which album he
wants to put it.
My problem is that I cant figure out how to tell in my PictureType to
select ONLY the collections of the current user.
here is my pictureType
$builder
->add('file')
->add('collection', 'entity', array(
'class' => 'AppPictureBundle:Collection',
'property' => 'name'
));
I want to insert after property something like this
Where 'user_id' = $this->getUser()
I have a manyToOne on Collection target User and a ManyToOne on picture
target collection.
No comments:
Post a Comment