php - Doctrine query select where date at time zone -
I have a postgradge table of events, where the time of time with the UTC with the time zone fields in the event time zone field The area is stored in The real time zone is stored in a different area.
i.e.
id, event_time, time_zone
1, 2013-10-15 10: 32: 21-05, 'America / Chicago'
2, 2013- 10-15 9: 32: 21-05, 'America / New York' etc.
I want to use Symphonie 2 / Theory 2 Query Builder which select events that occur within a certain time range expressed in local time. For example, I would like to select all the events from 10:15 onwards from 4:00 am to 5:00 pm local time.
In PostGrace, I can get it using the "AT Time Zone" function. Is the principle available similar to the query builder (except for the original class curriculum).
i.e. "SELECT * FROM incidents where event_time is a user defined in time zone (time_jone) and
Create a function:
& lt ;? Php namespace MyOrganization \ Bundle \ MyBundle \ DQL; Use the principle \ ORM \ query \ AST \ function \ function node; Use the principle \ ORM \ Query \ Lexer; Use the principle \ ORM \ query \ SqlWalker; Use the principle \ ORM \ query \ Parser; / ** * AtTimeZoneFunction :: = "AT_TIME_ZONE" "(" Arithmetic Elementary "," Arithmetic Elementary ")" * / Class Extitmotion Extends Function Node {// (1) Public $ Date Expiration = empty; Public $ timezone expression = null; Public function parsing (parser $ parser) {$ parser- & gt; Match (Lexer :: T_IDENTIFIER); // (2) $ parser-> Match (Lexer :: T_OPEN_PARENTHESIS); // (3) $ this- & gt; Date expeditions = $ paras-> Arithmetic primary (); // (4) $ parser-> Match (Lexer :: T_ COMMA); // (5) $ this- & gt; Timezone expansion = $ parse-> Arithmetic primary (); // (6) $ parser-> Match (Lexer :: T_CLOSE_PARENTHESIS); // (3)} public function getSql (SqlWalker $ sqlWalker) {return $ this- & gt; Date expression-> Remittance ($ sqlWalker) 'Time Time Zone ('. $ This-> Timezone Expression- & gt; Send ($ sqlWalker). ')'; // (7)}}
Comments
Post a Comment