Can you provide the output of the var_dump?


Sadly, this is not the case.

If I var_dump() the result from current(), I get the Row Object that I'm after.

Also, I can successfully invoke toArray() on the Rowset, but I don't really want the extra containing array when I only want one row.

Simon Mundy wrote:
Hi Jason
If you call current() on an empty Rowset, you'll get a null value. That's why the toArray() method will fail - it's likely that your find method returned no matching results.
Cheers

Forgive me if this is obvious, however, I can't seem to see what the issue is here.

This should work:
$this->_someTable->find(1234)->current()->toArray();

According to the API docs, the find() method of Zend_Db_Table returns a ..._Rowset, which then has the current() method, which returns a .._Row.
Zend_Db_Table_Row, in turn, offers the toArray() method

However, when running the above code, I get a *Fatal error*: Call to a member function toArray() on a non-object in...so on and so forth.

I have checked to see if current() is in fact returning an instance of Zend_Db_Table_Row, which it is. I have tried to run the same code without chaining, and I get the same issue.
I'm using 1.5.2.

Any suggestions would be greatly appreciated.

-Jason
--
Simon Mundy | Director | PEPTOLAB
""" " "" """""" "" "" """"""" " "" """"" " """"" "  """""" "" "
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124
http://www.peptolab.com


--

Simon Mundy | Director | PEPTOLAB

""" " "" """""" "" "" """"""" " "" """"" " """"" "  """""" "" "

202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124
http://www.peptolab.com

Reply via email to