foreach($messages->message as $message) { echo $message->message.'<br />'; }
That's basicly what most Orms do, especially those like ours that implement (parts of) the active record pattern.The Orm maps a table row to an object I think.
This could never ever work. The get() method returns an array of instances of Model_Message and you can't call the as_array() method on an array. The as_array() method is meant to turn a single object into an array. But that wouldn't help shohyuken even if it did work. The Orm returns an array as I stated thus should loop just fine, and it does as shohyuken demonstrated. Even if you were to loop an object it would work fine btw, it would just loop over the properties and relations.$messages = Model_Message::find()->where('request_id', 1)->get()->as_array();
echo Model_Message::find()->where('request_id', 1)->get_query();That should return the query the Orm generates, post both that and the query you're doing yourself and the output both generate when you run them manually. Use scrapyrd.com to post the output.
Jelmer Schreuder wrote on Monday 18th of July 2011:That's your problem, your primary key isn't unique. It has to be, otherwise the ORM can't work with it. The column your defining as your primary key, must also be the real primary key in the database.
Which is the problem, the Orm needs a primary key to distinguish one row from the next, without a primary key the Orm won't work. And no the lack of one can't be supported, ever.my primary key is unique, as a matter of fact, I didn't define any primary key, it's an empty array, because the table doesn't have any?
It looks like you're new here. If you want to get involved, click one of these buttons!