Orange Tux Tue Aug 21 08:26:11 -0400 2012

Subject: Issue with a not confentional model name and association.

I've 2 tables: containers and data.
This is a one:many relation.

I've 2 models: container en data. As you can see the table name of 'data' en model name are the same.
And that's the problem. When I want to create an association between containers and data I get the message
Class /Datum doesn't exists

class Container extends ActiveRecord\Model {

        static $has_many = array(
            array('data')
        );
    }    
class Data extends ActiveRecord\Model {

        static $table_name = 'data';

        static $has_one = array(
            array('container')
        );
    }    

How can I create an association while not using a confentional class name?


Gareth Hall Wed Sep 12 00:13:42 -0400 2012

Try

class Container extends ActiveRecord\Model {

static $has_many = array(
array('data', class => 'data' )
);
}

(1-1/1)