Welcome Guest, Not a member yet? Register   Sign In
Probably a php-related question..
#11

[eluser]Watermark Studios[/eluser]
noctrum makes a good point. I see what you're trying to do with loading only those catalogs associated with an asset.
Code:
$this->assets_mod->catalog_mod->test();
doesn't accomplish that. I would do it this way.
Code:
if (! defined('BASEPATH')) exit('No direct script access');

class Assets_mod extends Model {
    
    public $catalog;

    function __construct() {
        parent::Model();

        $CI =& get_instance();
        $CI->load->model('catalog_mod');
    }
    function catalog_test($args = null) {
        $this->catalog = new Catalog_mod($args);
        return $this->catalog->test();
    }
}
Where $args is a something you can pass that would define your catalog dataset. Now, all you have to do is is include the below in your controller:
Code:
$this->load->model('assets_mod');

$this->assets_mod->catalog_test($args);
It's not the chaining effect you are looking for, but it is simple and pretty darn close.
#12

[eluser]WanWizard[/eluser]
If that's the goal, you're getting dangerously close to an ORM:
Code:
$asset = new Asset();
$asset->where_related('catalog', 'type', $args)->get();
#13

[eluser]Watermark Studios[/eluser]
Time to bust out DMZ or Doctrine. Check out:
CodeIgniter + Doctrine
or
Datamapper OverZealous Edition

Lol...I use one of these in every project.




Theme © iAndrew 2016 - Forum software by © MyBB