seb otron Tue Feb 01 20:41:09 -0500 2011

Subject: Undefined property

Hello everyone. I've just started using php Activerecord and I get the basics. Here's my problem:

EDIT: Forgot the usual..

PHP Version: 6.0.0-dev
MySQL Version: 5

Table schema:
id int(11) UNSIGNED NOT NULL auto_increment
email varchar(255) NOT NULL DEFAULT ""
passwd varchar(255) NOT NULL DEFAULT ""
active tinyint(3) UNSIGNED NOT NULL DEFAULT 0
su tinyint(3) UNSIGNED NOT NULL DEFAULT 0

I have a User model with a table named "Users". On a user login I do a User::find($cond); and as you can see in the array print, the correct data is there. However, as soon as I try to access an attribute ($user->id for example), I get an Undefined property fatal error. This all seems pretty basic and I'm confused. Does anyone have a clue as to what could be my problem? Thank you!

Here's the array:

User Object

(
[errors] =>
[attributes:ActiveRecord\Model:private] => Array
(
[id] => 1
[email] =>
[password] => 12345
[active] => 1
[su] => 1
)
[__dirty:ActiveRecord\Model:private] => Array
(
)
[__readonly:ActiveRecord\Model:private] =>
[__relationships:ActiveRecord\Model:private] => Array
(
)
[__new_record:ActiveRecord\Model:private] =>

)

And here's the message:

Fatal error: Uncaught exception 'ActiveRecord\UndefinedPropertyException' with message 'Undefined property: User->id in /homepages/24/d355511032/htdocs/newproject/includes/php-activerecord/lib/Model.php on line 524' in /homepages/24/d355511032/htdocs/newproject/includes/php-activerecord/lib/Model.php:524 Stack trace: #0 /homepages/24/d355511032/htdocs/newproject/includes/php-activerecord/lib/Model.php(386): ActiveRecord\Model->read_attribute('id') #1 /homepages/24/d355511032/htdocs/newproject/index.php(37): ActiveRecord\Model->__get('id') #2 {main} thrown in /homepages/24/d355511032/htdocs/newproject/includes/php-activerecord/lib/Model.php on line 524


Kien La Fri Feb 04 17:20:12 -0500 2011

I can't see anything wrong with what you are doing but I see you are using PHP 6.0.0-dev. We haven't done any testing with that version of PHP and are not supporting it at the moment.

(1-1/1)