As he never explained and I had to search too, here it what you need  to do.
In the entity, when you define the onetomany relation, you can add an asset 
orderby

/**
 * @var ArrayCollection
 *
 * @ORM\OneToMany(targetEntity="Last_edition", mappedBy="homepage", 
cascade={"all"})
 * @ORM\OrderBy({"num_order" = "ASC"})
 */
private $last_editions;


Here we are

On Friday, June 22, 2012 at 9:35:20 AM UTC+2, Steve Sobel wrote:
>
> Thanks, I'll have to look up what that means - I'm pretty new to the 
> bundle... 
>
> Can I ask, since you seem to know the bundle:  Can I also have 
> drag/sort on an entity that isn't a onetomany?  For example I just 
> have "Items", no child relationships at all... does the Admin Bundle 
> support drag/sort on those as long as they have a sortable field? I 
> didn't see anything in the documentation but I'd love it if this 
> existed... 
>
> Steve 
>
> On Fri, Jun 22, 2012 at 2:25 AM, Thomas Rabaix <[email protected] 
> <javascript:>> wrote: 
> > You need to specify the collection ordering in the schema definition. 
> > 
> > Le 22 juin 2012 09:21, "Steve Sobel" <[email protected] 
> <javascript:>> a écrit : 
> > 
> >> Hello, 
> >> 
> >> I'm using the Admin bundle and so far it's great, but I have one 
> >> problem... I discovered the documentation that allows OneToMany items 
> to be 
> >> drag/drop sorted from here: 
> >> 
> >> 
> >> 
> http://sonata-project.org/bundles/doctrine-orm-admin/master/doc/reference/form_field_definition.html#advanced-usage-one-to-many
>  
> >> 
> >> The problem is this: 
> >> 
> >> Dragging and dropping to save a new sort order does work - it updates 
> the 
> >> database properly and they display in the right order on the frontend 
> of my 
> >> website -- but in the admin, the query doesn't sort them using my 
> >> displayOrder column, so the order looks wrong on page load even though 
> it 
> >> properly saved the order I dragged/dropped! 
> >> 
> >> It would seem to me that since I specified which field was the 
> "sortable" 
> >> field in the spec that it should know to order on that field, shouldn't 
> it? 
> >> Is this a bug, or am I perhaps doing something wrong? 
> >> 
> >> Steve 
> >> 
> >> -- 
> >> You received this message because you are subscribed to the Google 
> Groups 
> >> "sonata-users" group. 
> >> To view this discussion on the web visit 
> >> https://groups.google.com/d/msg/sonata-users/-/x8qgy9xeJtwJ. 
> >> To post to this group, send email to [email protected] 
> <javascript:>. 
> >> To unsubscribe from this group, send email to 
> >> [email protected] <javascript:>. 
> >> For more options, visit this group at 
> >> http://groups.google.com/group/sonata-users?hl=en. 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "sonata-users" group. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > To unsubscribe from this group, send email to 
> > [email protected] <javascript:>. 
> > For more options, visit this group at 
> > http://groups.google.com/group/sonata-users?hl=en. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sonata-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sonata-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to