I'm using a model of other component in my component. I'm following this solution. But, when I try to call the getItem method of the model I get the error "Call to a member function load() on a non-object". In the model, the lines that cause the error is:

    $table = $this->getTable();

    // Attempt to load the row.
    $return = $table->load($itemId);

What am I missing?

  • Hard to really guide without more code. However, I'd start with doing a var_dump($table); before attempting to load the row to see what's being returned, and if it isn't an instance of the table class you're requesting, step through the getTable() method to see what params are being supplied to it, what it's trying to load, and where it's failing.
    – Michael
    Apr 26, 2014 at 16:55
  • @Michael the var_dump returns bool(false). The model belongs to other component, so it is trying to load a table from that component. Take a look at the link above to see how I'm importing the model.
    – csbenjamin
    Apr 26, 2014 at 17:04
  • And the getTable() should theoretically work also. You may need to call JTable::addIncludePath(/path/to/other/component/tables); to ensure that component's table classes are getting loaded.
    – Michael
    Apr 26, 2014 at 17:08
  • Yeah! The JTable::addIncludePath works. Thanks
    – csbenjamin
    Apr 26, 2014 at 17:11
  • Moving my last comment over as an answer, if you could help out with the beta and mark that as accepted it'd be appreciated. :-)
    – Michael
    Apr 26, 2014 at 17:13

1 Answer 1


You may need to import the table classes also. Try calling JTable::addIncludePath(/path/to/other/component/tables); to bring them in.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.