OK, so I'm building a find query that needs to use simple arithmetic
within the fields that are selected, and then assign the result of the
arithmetic to an alias. Wow.. that was a pretty obscure sentence. :)
Here's what I mean (the statement is simplified but the important part
is there):
$this->Report->find('all', array(
'contain' => array('StartImport', 'EndImport')
'fields' => array(
'(EndImport.a - StartImport.a) AS a'
)
);
So, I'm subtracting the "a" column of StartImport from the "a" column
of "EndImport", and I want that to be returned as "a". The problem is,
when DboSource is building the query it incorrectly parses the second
period (the one after StartImport) as the end of the field, and the
field ends up in the query like this:
"SELECT (`Statistic`.`a` - `StartImport` FROM reports..."
It's getting to Startimport and then just chopping off everything
afterwards. This is happening in DboSource::fields(), but obviously I
don't want to start hacking away at such a core function.
So my question is: am I doing something wrong? Am I missing something
obvious? Is there a better way to return what I need? Or could this be
a bug?
- Jamie
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---