[eluser]sophistry[/eluser]
wow... super fast reply!
so, i see from your example and from my own testing that you *can* (maybe?) leave out the join_table setting for habtm setting and the system determines it by default. but, i tried that and it didn't seem to work. i might have something else wrong though...
i am trying to take the quick start HABTM set up (with slightly different table names) and convert it to use yaml. so, i know the datamodels, data, and code have all worked before!
here's my yaml factory instance code:
Code:
// define the two models in constructor
// (not defining a yaml-driven model for join
// table beings_groups because i didn't have
// to before i started using yaml)
$this->being = IgnitedRecord::yamlfactory(APPPATH.'definitions/being.yaml');
$this->group = IgnitedRecord::yamlfactory(APPPATH.'definitions/group.yaml');
my call to find() (which works) and the subsequent $rec1->related():
Code:
$rec1 = $this->being->find(1);
echo 'being '. $rec1->first_name .' belongs to groups:<br>';
$related_recs = $rec1->related('groups');
foreach($related_recs as $r)
{
print_r($r->group_name.'<br>');
}
and my yaml:
Code:
table: beings # necessary
habtm:
name: groups
the print_r() says "Message: Undefined property: group_name" but there is a field in the groups table. and the data is there.
do you see any problems with this?
on another note
---------------
as you say IR has these two modes:
1) simple: default settings and minimal configuration as long as you follow conventions
2) advanced: all settings can be specified away from the default conventions for the ultimate flexibility with existing db installations
since i am not completely fluent in IR, it is sometimes hard for me (and other new users i'm sure) to know exactly which settings are option for the various techniques of model instantiation (extend IR, factory, yamlfactory). as a general suggestion for examples, could you try to be a little more verbose when you comment those things?
another final thing... is it possible to load just one yaml file that holds all the definitions? my schema has about a dozen tables and i'd like to be able to just have them all in one single file. i know i can write a wrapper function and just parse them out myself, but i wonder if that capability is already in the system somewhere, undocumented? if it's not, i'd be happy to accept guidelines for development and contribute such an item when i get it working. :-)
thanks!