Subject: Serialize not including self-referential associations
Not sure if this is a bug or if I'm doing it wrong. Here's the model:
class Org extends ActiveRecord\Model { static $table_name = 'orgs'; static $primary_key = 'org_id'; static $belongs_to = array( array('parent', 'class_name' => 'Org', 'foreign_key' => 'parent_id') ); static $has_many = array( array('orgusers'), array('users', 'through' => 'orgusers') ); }
It works well but when I attempt to serialize the result, it will not serialize the parent property (association). Can someone tell me if this is a bug?
$org = new Org; $options = array( ... some options ... ); $result = $org->find($org_id, $options); $result->to_json(array( 'include' => array('parent') ));
This forum has been really dead lately. Any help is appreciated. :)
June 27 2010
September 23, 2011
Subject: Serialize not including self-referential associations
Not sure if this is a bug or if I'm doing it wrong. Here's the model:
It works well but when I attempt to serialize the result, it will not serialize the parent property (association). Can someone tell me if this is a bug?
This forum has been really dead lately. Any help is appreciated. :)