Hello everybody,

I've got an interesting problem with my DQL - it returns me less results 
than raw SQL query.

Have a look at: http://airliners.megazine.net/airlines?page=2
this page lists airlines ordered by name, third result on that page has a 
name which is not in order - it should bear name "Arik Air" though this 
particular aircraft is operated by airline "Hi Fly" which does not show up 
on the list on the page 4: http://airliners.megazine.net/airlines?page=4 
where I would expect it to see.

DQL query in question:

        $query = $this->_em->createQuery("
            SELECT
                a.id,
                a.name,
                a.icao,
                a.iata,
                p AS picture
            FROM
                Airliners:Airline a,
                Airliners:Picture p
            WHERE
                p.id = (
                    SELECT MAX(sp.id)
                    FROM Airliners:Picture sp
                    LEFT JOIN sp.airliner sa
                    LEFT JOIN sa.airline saa
                    LEFT JOIN sa.remarks sr
                    LEFT JOIN sr.airline sra
                    WHERE saa.id = a.id OR sra.id = a.id
                )
            " . ( $filter->getQuery() ? "AND (a.name LIKE :query OR a.icao 
LIKE :query)" : '' ) . "
            ORDER BY
                a.name
        ");

If I get a raw SQL from this DQL and run it in mysql, I get both Arik Air 
and Hi Fly on the list, when I get results from DQL, I get one result.

It gets more interesting though, if I search for both airlines, it finds 
them with no issues:

http://airliners.megazine.net/airlines?query=Arik+Air - will return right 
airline with right description, as well as this:
http://airliners.megazine.net/airlines?query=Hi+Fly

Many thanks in advance! Any help is much appreciated!
Marek

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" 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 http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to