Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Loading a Model in a Module
  • I have read around the forums in many of the related posts and I have also read the documentation as best I can regarding this, but I think there's a bit of a "hole" in the logic I have now. I have read all about making requests in HMVC and modules and have also read how to load models themselves. However, I can't find anything in the documentation about loading a model within a module. I made a controller in the model and I used this code:
            // Load a Module
            \Module::load('website');
           
            // Test load a model
            $new = new Model_Page();
            $new->active = '1';
            $new->title = 'Test';
            $new->save();
    

    The model is in the same module and has the file name page.php
    The model class is definitely Model_Page
    The function that holds this code is definitely running What am I missing? Additional Information:
    Version: 1.2 RC1
    Packages: ORM, Auth
    Error: ErrorException [ Error ]: Class 'Website\Model_Page' not found
  • The Answer After scratching my head I realized that I had only defined the namespace on the Controller.
    Once I declared the namespace on the model all fell into place.

Howdy, Stranger!

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

In this Discussion