Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Modules and Fuel\Core namespace
  • Instead of prefixing all the core classes I'm using in Module namespaces with backslashes, is it possible to allow my application to load the class from the \Fuel\Core instead if not present in the Module namespace? For example, if I have
    namespace Users;
    
    class Controller_Users
    {
        public function action_index()
        {
              return Response::forge(View::forge('users/index'));
        }
    }
    

    and confirming there is no Response or View class in my namespace, I want to load it from the \Fuel\Core namespace instead. Thanks in advance!
  • You could set up some crazy aliassing in your autoloader, something we had in a very early version of Fuel. But that just leads to loads of aliasses to the same class and in the end you don't have a clue where it came from. Prefix a backslash and take it from global.
  • I just patched up the autoloader and everything's working how I like, I don't see any problems (yet) and I'm not really understanding while class aliases are bad
  • Well, for starters it negates the use of namespaces, which are there for a reason.

Howdy, Stranger!

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

In this Discussion