hi add custom function doctrine.
i need add mysql field function able order size here: mysql custom order mixed data types
so use exemple: https://github.com/beberlei/doctrineextensions/blob/master/lib/doctrineextensions/query/mysql/field.php
and try add symfony2 that: http://symfony.com/fr/doc/current/cookbook/doctrine/custom_dql_functions.html
when do:
$querybuilder->addorderby("field(size, 'xs', 's', 'm', 'l', 'xl', 'xxl', 'xxxl'), size, length", 'asc');
i error: error: expected end of string, got '('
any idea how implement it?
you cannot use dql functions within order by
clause. must select result of field()
function hidden field , sort results using field:
select ..., field(size, ...) hidden sizeorder ... order sizeorder
sizeorder
field won't affect results won't hydrated.
Comments
Post a Comment