Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
find all fields (*) with some extra #558
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
nateabele
Jun 25, 2012
Owner
This gets into the somewhat deeper issue of mapping result sets, which you technically can do manually already, it's just not super straightforward. This is probably a longer-term enhancement.
This gets into the somewhat deeper issue of mapping result sets, which you technically can do manually already, it's just not super straightforward. This is probably a longer-term enhancement. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
If you can give some pointers... |
nateabele
closed this
Dec 18, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hans-d commentedJun 24, 2012
Using the
fields
key in a find to return a SQL function output works fine. However, when all fields from a model are required and some functions, it is not possible to specify'*'
. The generated SQL is fine, but the returned data is not mapped to the entities. but you get the right amount of (empty) entities...Works:
Model::first(array('fields' => array('field1', 'CASE field1 WHEN "" THEN true ELSE false END as check'));
Does not work:
Model::first(array('fields' => array('*', 'CASE field1 WHEN "" THEN true ELSE false END AS check'));
Prefixing the
'*'
with the Model name / alias does not work.The only workaround is to do something like
All within the MySQL context on master.