Message from discussion
Custom orderBy with FIELD
MIME-Version: 1.0
Received: by 10.100.191.16 with SMTP id o16mr47132anf.3.1247100471377; Wed, 08
Jul 2009 17:47:51 -0700 (PDT)
Date: Wed, 8 Jul 2009 17:47:51 -0700 (PDT)
X-IP: 123.243.104.134
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1)
Gecko/20090624 Firefox/3.5 FirePHP/0.3 AutoPager/0.5.2.2 (http://www.teesoft.info/),gzip(gfe),gzip(gfe)
Message-ID: <40275916-834d-4b64-af19-1589226faf6a@t11g2000prh.googlegroups.com>
Subject: Custom orderBy with FIELD
From: conankun <hendrachrist...@gmail.com>
To: doctrine-user <doctrine-user@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Hi,
I would like to know if it's possible to do a custom orderBy with
Doctrine? In other words, is there any Doctrine equivalent to this
SQL:
SELECT * FROM `table` ORDER BY FIELD(id,2,5,3,6,4,1);
I know I can do a normal Doctrine_Query and traverse the results array
and do manual sorting (which is my current alternative), however it
would be good if I can just grab the custom sorted data straight from
the SQL (since MySQL also supports this).
If it's currently not possible, I hope it will be added in the future,
thx.
PS: Let me know if this suppose to be a support ticket or something.
Cheers,