If the CodeIgniter Community Branch was a fork... |
[eluser]TaylorOtwell[/eluser]
[quote author="Phil Sturgeon" date="1291219362"][quote author="Rick Jolly" date="1291177348"][quote author="Michael Wales" date="1291170340"]Many of the ideas you listed were discussed when Phil Sturgeon setup that chat session last week, ideas #1-4 specifically.[/quote] Yep, #1 was deleted from his document[/quote] It was removed pending discussion, as nobody actually detailed how auto-loading would work. What's are your ideas for the implementation?[/quote] Beyond auto-loading, re-working some things to use Dependency Injection (via constructor injection) would really improve the framework, IMO. I've already changed CI to do this but it required a few lines of hacking in some Core files and writing an IoC container for CI. But, it allows you to use type-hinting in your constructor parameters and let the DI framework inject those dependencies for you. So, my controller constructors look like this: Code: public function __construct(IFoo $foo) And I setup which implementation of IFoo the system should use in an application/config/dependencies.php file using the IoC container like this: Code: CInject::container()->bind('IFoo')->to('Foo'); Now, everytime CI instantiates a controller that needs an "IFoo", it will inject an instance of "Foo" (and it will resolve Foo's constructor dependencies as well). This allows for really flexible code and switching implementations easily. Also, adding ASP.NET MVC style "Model Binding" would be a big plus. I've also added this myself, but it required some more hacking. Basically, on an HTTP POST, bind the POST data to the controller function parameters if the names match, so that if I have a function that looks like this: Code: public function login($email, $password) {} And if my form contains an "email" field and a "password" field, the values will automatically be passed into the function. Or, you could even use type hinting in the function and bind the POST values to an object's properties. I use reflection in conjunction with my IoC container to accomplish this. |
Welcome Guest, Not a member yet? Register Sign In |