Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Orm
How to use MySQL functions in 'where' section
mantinia
February 2014
I want to use MySQL function in where section.
For example:
$q = Model_Foo::query()->where(DB::expr('YEAR(birthday)'), '=', 1980);
* `birthday` field type is datetime.
But this code doesn't works. It returns ErrorException 4096.
How should I do? Please help.
I'm using ver. 1.5
Harro
February 2014
I'm not sure DB::expr() was supported in where() clauses back in 1.5.
What is the exact error message you get?
mantinia
February 2014
Thanks to your response.
The message is here.
Argument 1 passed to Orm\Query::_parse_where_array() must be an array, object given,
called in /path/to/fuel/packages/orm/classes/query.php on line 529 and defined
Harro
February 2014
Accepted Answer
As I expected, you can not use DB::expr() in 1.5.
mantinia
February 2014
Thank you. I look for the another way.
Harro
February 2014
Upgrade to 1.7.1 (or even 1.8/develop) would be the logical fix for this?
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,089
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
261
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
February 2014
mantinia
February 2014