I am trying to get Doctrine2 Entities, ordered by their ID which apparently is a String even though it contains only Numbers.
So what I would like to do is something like this:

SELECT entity1, cast (entity1.id AS integer) AS orderId
FROM Namespace\Bla\MyEntity 
ORDER BY orderId


Is there a way to do something like this in Doctrine2?
Or, what would be the best practise to get my Result if i can't change the type of the id (due to customer requirements of course)?



Attention: I am not asking SQL Code, i am asking for a Doctrine2 Solution, preferably in DQL


Question: What's the difference between a plant and an animal?
Answer: Yeast are neither plants nor animals; they are fungi. The old classification where things were lumped into only two buckets - plants or animals - has long since broken down. In fact, even things you might think of as plants, like algae or most seaweed are no longer classified as plants. Under the old system, plants and animals were considered kingdoms, and the latest classifications now divide the Eukaryotes into six kingdoms, but even this is poorly evidenced and facing challenge.

The best method of classification is probably cladistics which is based on the evolutionary history of organisms - but even it has problems when you start considering what to do with horizontal gene transfer and endosymbiosis. Because under a cladistic view, plants and animals are defined not by their features but by their ancestors your question becomes moot, I think.