Brian Cain Thu Aug 15 00:52:10 -0400 2013

Subject: Model has no attributes???

Here is my model...
class Order extends ActiveRecord\Model {
public static $table_name = "orders";
public static $primary_key = "o_key";


When I do this...
$myOrder = new Order();
$myOrder->o_key = $new_key;

I get the error...
Fatal error: Uncaught exception 'ActiveRecord\UndefinedPropertyException' with message 'Undefined property: Order->o_key

Any insight or other questions needed to diagnose would be much appreciated.

Brian Cain Thu Aug 15 00:53:41 -0400 2013

Sorry... I say "has not attributes" because when I do this....
echo count($myOrder->attributes()); ... I get a big fat zero!

Brian Cain Wed Sep 04 01:24:35 -0400 2013

I am still having this issue... someone has some help to offer.. I just know it!

Megan McVey Thu Sep 05 11:42:50 -0400 2013

I'll try.

Does the table 'orders' exist in the database already?
Does the table 'orders' have an o_key field?

Tables and fields must already exist.

Brian Cain Sun Sep 08 13:41:22 -0400 2013

Yes and yes. Thank you for asking...

Would other errors occurring previously in the page cause this? This is driving me nuts... do you have any debugging steps you'd take to figure this out?

Brian Cain Mon Sep 16 01:31:58 -0400 2013

I'm getting this same issue with more models I have added to my project... Even if a I do a mass adssignment upon creation... when I try to save or set any other prop.. I get this same error.