I searched for month() and found this:
https://www.simukti.net/blog/2012/04/05/how-to-select-year-month-day-in-doctrine2/
I copied the saved on site as findOneByYearMonthDay.php and uploaded it
/Doctrine/ORM/DoctrineExtensions then saved Month.php, Day.php, Year.php
and uploaded them to /Doctrine/ORM/DoctrineExtensions/Query/Mysql (as
namespace is so)
then added:
$classLoader = new Doctrine\Common\ClassLoader('DoctrineExtensions',
"Doctrine/ORM/DoctrineExtensions");
$classLoader->register();
in bootstrap.php but now I still cannot query "SELECT month(c.joinDate)
FROM Entities\Client c".
Please advice how can I get it worked? and what wrong I did?




On Mon, Feb 17, 2014 at 12:35 AM, Herman Peeren <[email protected]>wrote:

> When I search on Google for "dql doctrine unix_timestamp" I get 1.300.000
> results. I only looked at the first 4, which all hint in the same
> direction. You'll probably find a solution there. Please try that first,
> before posting here. Thank you.
>
>
> On Sunday, 16 February 2014 17:08:26 UTC+1, Parsifal wrote:
>>
>>
>> I have difficulty to turn this sql in dq. please help I have a join_date
>> coloumn in clients table (joinDate in entity), and it is a unix timestamp.
>> now how to turn this in dql? for unix_timestamp I can use time() before dql
>> line but how about the rest of it? if not possible how to turn it in
>> NativeSQL?
>>
>>
>> $dql = "SELECT month(from_unixtime(join_date)) AS month, count(*) AS
>> signup, c_status AS status FROM clients WHERE join_date between
>> unix_timestamp('{$year}-01-01') and unix_timestamp('{$year}-12-31
>> 23:59:59') GROUP BY status, month";
>>
>>
>  --
> 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/groups/opt_out.
>

-- 
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/groups/opt_out.

Reply via email to