Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Unable to load Model in module
  • Hi there !

    I'm brand new to FuelPhp, coming from Codeigniter, so i'm still in a early learning phase.

    I'm trying to use the modules, but I guess I'm doing it wrong. I can access the controller directly with the /quizz/install url, but I cannot load a model within it, it throws me an exception : ErrorException [ Error ]: Class 'Quizz\Quizz' not found

    I cannot figure what I'm doing wrong, even after a lot of research on the net.


    The structure of the module
    image


    The controller

    image


    The model
    image
  • Your model is called Model_Quizz, not Quizz, so you need to use

    Model_Quizz::install($data);
  • Nop, doesn't change anything :/

    Same if I change the Model name to Quizz only.
  • It's in the classes/model folder, so it has to be named Model_Quizz, otherwise the autoloader can't find it.

    I don't see anythese else that can be wrong. Are you getting "class 'Quizz\Model_Quizz' not found"?

    You request this controller using '/quizz/quizz/install' ?

  • Yep, same error : ErrorException [ Error ]: Class 'Quizz\Model_Quizz' not found

    I request the page through /quizz/install, using /quizz/quizz/install throws me the same error
  • Weird.

    And everything is like in your original post? No filenames with uppercase letters for example?
  • Nop, I changed nothing except what you told me to : Model_Quizz::install($data);

    It's not my day I think !
  • Just recreated this module here, using your exact code (and using Model_Quizz::install()), and it works as expected. So it must be something local.

    Given the fact that your controller loads, there's nothing wrong with the module definition itself, and the frameworks config is ok too.
  • I made a fresh install to a new folder, copy / paste the folder Quizz to modules.
    Then uncomment the module_path in config.php

    And again, same error : ErrorException [ Error ]: Class 'Quizz\Model_Quizz' not found

    I'm on a MAMP server, MacOsx 10.7.5. What can be the cause of that ? :/

    Edit: problem solved, and I don't even know why. But it works, so I'm half happy ! Thanks for the help :)
  • You don't know what you changed to fix it?
  • Not a clue !

    All I can think of would be a corrupt file, but even that seems strange...

Howdy, Stranger!

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

In this Discussion