[eluser]Khrome83[/eluser]
When auto creating models, is there anything that is cached? I had a type-o in a column name in the Pivot table, but fixed it. Now every other relationship and model works well, with the exception of the table that had a type-o.
When access contents of the table directly it works -
Code:
$profs = Gas::factory('professions')->all();
foreach($profs as $bar) {
echo '<br /><br />';
echo 'Professions - '.$bar->name;
//echo print_r($bar);
}
When accessing it through skills -
Code:
$skills = Gas::factory('skills')->all();
foreach($skills as $skill) {
echo 'Skill Name Found - '.$skill->name;
echo '<br /><br />';
//echo print_r($skill);
echo wtf($skill);
foreach($skill->professions as $p){
echo '<br /><br />';
echo 'Profession Requirement - '.$p->name;
echo '<br /><br />';
}
}
I tried to use with('professions') when accessing skills with no luck as well. All other relationships set up the same way work fine. I checked all models for any type-o's that were created because of my earlier error.
Skill Relationships -
Code:
class Skills extends Gas {
public $table = 'skills';
public $primary_key = 'id';
public $relations = array(
'has_many' => array('pets' => array('through' => 'skills_pets'),
'races' => array('through' => 'skills_races'),
'types' => array('through' => 'skills_types'),
'professions' => array('through' => 'skills_professions'),
'sets' => array('through' => 'skills_sets')
)
);
Professions Relationships -
Code:
class Professions extends Gas {
public $table = 'professions';
public $primary_key = 'id';
public $relations = array(
'has_many' => array('skills' => array(
'through' => 'skills_professions',
)),
);
Pivot Table Relationships -
Code:
class Skills_professions extends Gas {
public $table = 'skills_professions';
public $primary_key = 'id';
public $relations = array(
'belongs_to' => array('skills' => array(),
'professions' => array()
),
);