Skip to content

group_concat with orderBy #978

Open
Open
@Mopster

Description

@Mopster

Hi,

I'm trying to order the data in a group_concat but can't figure out how to do it.

Email is an ORM entity with a isPrimary boolean. I need the primary email addresses to be first. In the grid (export) the ORM orderBy is ignored.

    /**
     * A Person can have many Emails.
     *
     * @ORM\OneToMany(targetEntity="Email", mappedBy="person", cascade={"persist", "remove"}, orphanRemoval=true)
     * @ORM\OrderBy({"isPrimary" = "DESC", "inactive" = "ASC"})
     * @Grid\Column(field="emails.value:group_concat:order_by:emails.isPrimary:desc", title="email", visible=false, export=true) // primary emailaddress
     * @Grid\Column(field="emails.value:group_concat:distinct", title="all emails", visible=false, export=true)
     * @Assert\Count(min = "1", groups={"Preregistration", "Registration", "Custom"}),
     */
    protected $emails;

I tried several syntax versions of emails.value:group_concat:order_by:emails.isPrimary:desc but no so far no luck. the group_concat seems to support an orderBy property : https://github.com/beberlei/DoctrineExtensions/pull/111/files

Is this supported ? If so, how do I use it ? If not, is there another way I can get the emails sorted correctly ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions