I have a lot of difficulties in trying to translate this SQL query to a DQL one (I am using Symfony2).
SELECT d.* FROM Document d JOIN DocumentType dt ON dt.id = d.document_type_id WHERE (d.dateFinal - INTERVAL dt.renewal SECOND) > NOW();"
Thanks a lot !
Instead of database fields, you need to use the fields of you
DocumentandDocumentTypeclasses.The join is done by naming the association field of your document (something like
d.documenttype)For those MySQL date functions: At least as far as I know, you would need to write custom DQL functions. Behind that link there is an example of an
INTERVALfunction. This might be the point where you want to execute the native SQL query instead.