wierd problem with getting data from model

edited October 2013 in News & Announcements
I have two identical models
1.projects_model [used to manage data used by Projects module in admin area]
2.projects_all_model [used to list and filter data in views]

projects_model is defined in MY_fuel_modules so it shows up in admin area

My projects view when I test with 1st model works fine but 2nd module even with exactly same code, pulls the data but I get following error, where as line 41 is simply printing <?=$project->heading?> What am I doing wrong? Do i need to define 2nd model in MY_fuel_modules? I can see the data in $project when i do print_r($project).

A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: views/recent-projects.php

Line Number: 41

Comments

  • edited 8:48AM
    Did you define the record class as well? FUEL will assume it's the name of your Table class without the plural "s" but in your case, you'll need to specifically add it as a property to your Projects_all_model table class:
    public $record_class = 'Projects_all_item';

    Then make sure you have this class below the Projects_all_item class (in the same file)
    class Projects_all_item_model extends Base_module_record {
    // your record model code goes here
    }
Sign In or Register to comment.