A B Wed Jan 30 16:46:17 -0500 2013

Subject: Empty attributes

Hi !

I'm desperately trying to implement this activerecord library on my framework. But I only get a "Undefined property" with my models.

I have a parent class like that :

abstract class Model extends\ActiveRecord\Model {
public static $connection = 'mysql';
}

My model looks like :

class Admin extends Model {
public static $table_name = 'core_admin';
}

The connexion with the database seems to be ok because when I debug an Admin::all(), I have the correct number of records :

array (
0 =>
Admin::__set_state(array(
'errors' => NULL,
'attributes' =>
array (
),
'__dirty' => NULL,
'__readonly' => false,
'__relationships' =>
array (
),
'__new_record' => true,
)),

etc

I supposed the problem comes from the empty '$attributes' property but I don't know why and how to resolve it.

Could you help me, please ? :)


A B Mon Feb 11 14:04:11 -0500 2013

As found in another topic, the problem was a constructor that didn't respect the signature of the Activerecord\Model's constructor --'

I hope this topic could help someone in future.

Virginia Andersson Mon Nov 03 14:13:30 -0500 2014

I'm having the exactly same problem, but i do not have any constructor function to remove from my ORM class.

It dumped $var like this when i call $var = new CalendarORM

CalendarORM::__set_state(array(
'errors' => NULL,
'attributes' => array (
),
'__dirty' => NULL,
'__readonly' => false,
'__relationships' => array (
),
'__new_record' => true,
))

and i'm not able to save information on the columns (attributes) of my table. I receive a error message: 'Undefined property: CalendarORM->name in /vagrant/.../system/vendor/php-activerecord/php-activerecord/lib/Model.php on line 420'

I didn't find any solution for this problem.

(1-2/2)