Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Get Single Result with a chained ::find()->where()
  • I've got this code here that is running in a task http://scrp.at/Vq and it gives me this error Error: Invalid argument supplied for foreach() in /Users/jon/Sites/.../fuel/packages/orm/classes/query.php on 119 Line 119 == Line 16 (in the scrap) I have a feeling it is because I have a single result, so it doesn't have an array of results to loop over, but this is just an educated guess.
  • How about:
    $query = \Model_Question::find('first')->where('text', $sug['text']);
    
  • @Phil, that won't work - the 'first' arg can't be combined with the method chaining syntax. @jondavidjon
    I'm not sure what's wrong, but from the error I can deduce you're using RC2. This may have already been fixed in develop. On the other hand the error is occuring in the select() method, and as such maybe you didn't configure the properties right?
  • Can we make that work? Is it designed specifically to not work for a reason and if so, what reason?
  • When you use 'first', 'last' or 'all' the options array is used and the query is executed immediately. When you don't use any of those (thus null) a query object is returned for you to finish.
  • Updated ORM package to the develop branch and it changed the error. I'm now getting "zend_mm_heap corrupt" Which all the googling I've done points to increasing the output buffer in my php.ini But this seems strange for a task that doesn't even have any output. Also, after reading through the php docs (which may or may not apply) it says that output buffering is always off for PHP-CLI
  • running anything that does output buffering, caching or accelerating? Running ZendDebugger?
  • Not that I know of, running a standard MAMP Pro local setup. SS of my php setup http://cl.ly/0i2J3W0q2M343H3C153Q
  • I know MAMP is a strange beast, but as I don't have a Mac, I can't help you any further. I know though that PHP 5.3.2. wasn't the best of releases, so that might have something to do with it...

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion