@Khrome83 and @Dan Tdr
To answer your question, if I use this code, where the only thing that changed is that all() is replaced with find(1), i get errors.
Code -
$skills = Model\Skills::find(1); $this->output->enable_profiler(TRUE); foreach ($skills as $s) { echo $s->name.' '; foreach ($s->types() as $t){ echo $t->name.' '; } foreach ($s->professions() as $p) { echo $p->name.' '; } foreach ($s->weapons() as $w) { echo $w->name.' '; } //wtf($s); }Outputs -
A PHP Error was encountered Severity: Notice Message: Trying to get property of non-object Filename: views/welcome.php Line Number: 69 Fatal error: Call to a member function types() on a non-object in /home/guildwar/public_html/application/views/welcome.php on line 70
Obviously, you are trying to itterate object there, not an array. Try :
// Here you are try to find one record
$this->output->enable_profiler(TRUE);
$skill = Model\Skills::find(1);
foreach ($skill->types() as $t)
{
// Do your job with $t here
}Hey toopay,
I searched for this info but with no luck, how can i use Gas ORM 2 with HMCV (Modular Extension) i want to put my models in my modules and not keep them in a folder models in my application folder. How can i do that?
Thank you,
Dan
Khrome83 already pointed to the right section. For example you have “foo” and “bar” module, located in application/modules, you could have something like this :
$config['models_path'] = array(
'Model' => APPPATH.'models',
'Model\\Foo' => APPPATH.'modules/foo/models',
'Model\\Bar' => APPPATH.'modules/bar/models',
);If your modules located outside your application folder, just modify the location with an absolute path within your modules.