Git Product home page Git Product logo

Comments (7)

mruz avatar mruz commented on July 24, 2024 1

It's easy to implement, how about $di = null by default, to keep backward compatibility?
https://github.com/ice/framework/blob/dev/ice/dispatcher.zep#L189
https://github.com/ice/framework/blob/dev/ice/mvc/moduleinterface.zep#L18

from framework.

Yahasana avatar Yahasana commented on July 24, 2024 1

@mruz it's fine!

from framework.

mruz avatar mruz commented on July 24, 2024 1
let loader = this->di->get("loader")

Will get the loader from te di or create a new if not exist, so maybe that way.
Then ModuleInterface::registerAutoloaders(Loader $loader = null), you won't need to update your app if you have just registerAutoloaders() in every module.

from framework.

Yahasana avatar Yahasana commented on July 24, 2024

an amazing feature that allow user to set a higher loading order for the current module when prepend the loading namespaces: $di->loader->addNamespace(__NAMESPACE__ . '\Controllers', __DIR__ . '/controllers/', true);

from framework.

Yahasana avatar Yahasana commented on July 24, 2024

After a sound thought, pass the loader loading the current module to registerAutoloaders($loader) to allow developer control the module loading process.

if people want to access the $di instance, it can be done in registerServices(Di $di)

BTW, add Loader $loader = null to ModuleInterface::registerAutoloaders(Loader $loader = null) doesn't keep backward compatibility. So, ModuleInterface::registerAutoloaders(Loader $loader) is ok

from framework.

Yahasana avatar Yahasana commented on July 24, 2024

@mruz please check my last comment. the follow code will not work as expect, as the loader of the module is not the same as the one in $di->loader. it safe to pass $loader but not this->di.

    // better performance
    public function registerAutoloaders(Di $di)
    {
        $di->loader->addNamespace(__NAMESPACE__ . '\Controllers', __DIR__ . '/controllers/');
    }

from framework.

mruz avatar mruz commented on July 24, 2024

I didn't see your comment.

from framework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.