Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
ErrorException [ Error ]: Class 'Model_Group' not found
  • I'm not sure if this is an ORM issue or a Routing-ish issue. But I scaffolded myself the table Groups with just a name:string.
    So it created the model, controllers and CRUD views for me.. However when I visit /groups it gives me the following error:
    ErrorException [ Error ]: Class 'Model_Group' not found
    
    4    public function action_index()
     5    {
     6        $data['groups'] = Model_Group::find('all');
     7        $this->template->title = "Groups";
     8        $this->template->content = View::factory('groups/index', $data);
     9    }
    
  • You are meant to provide the singular word to generate a controller but I have worked on this in the develop branch to make things a little more robust.
  • Try Model_Groups instead of Model_Group. I'm pretty sure I remember running into this bug.
  • A class not being found isn't a bug, it always means you got something wrong: either a namespace, a classname or the filename. All must match the rules for autoloading or your class won't be found.
  • Gerben Jacobs wrote on Friday 17th of June 2011:
    But I scaffolded myself the table Groups with just a name:string. So it created the model, controllers and CRUD views for me..

    The bug is that when the controller / model is generated, if the name is plural, the file gets created as plural, but not the class name: Example: oil generate controller plurals index Creating controller: /Users/calvinfroedge/htdocs/froedge/fmslumberhandling/code/fuel/app/classes/controller/plurals.php Here's what gets generated for class name: class Controller_Plural extends Controller_Template If it's not a bug, it's very confusing.
  • That would depend if it was generated with oil... or typed ;)
  • It was generated by oil
  • That does look like a bug, though if you already knew about it why didn't you report it on https://github.com/fuel/oil/issues ? Also moved the discussion to the Oil forum as it's about Oil, not the Orm.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion