Recently I have started coding with Symfony and Propel 2.x, and I came across a problem with WHERE IN clause.
I want to get clients that was born in 1993 and 1988.
So I have written this Propel Query code fragment:
$query = ClientQuery::create()
->where('YEAR(Client.Birthdate) IN ?', [1993, 1988])
->find();
... and the ORM mapped these integers as DateTime object, so final query look like:
SELECT clients.id, clients.user_id, clients.first_name, clients.last_name, clients.birthdate, clients.document_id, clients.street, clients.postal_code, clients.city, clients.country
FROM clients
WHERE YEAR(clients.birthdate) IN ('1970-01-01','1970-01-01')
Is there way to use Propel to build query like below, without using RAW SQL query?
SELECT clients.id, clients.user_id, clients.first_name, clients.last_name, clients.birthdate, clients.document_id, clients.street, clients.postal_code, clients.city, clients.country
FROM clients
WHERE YEAR(clients.birthdate) IN (1993, 1988)
I have tried add YEAR(clients.birthdate)
to SELECT with alias but also I can't get expected query.