lundi 2 mai 2016

Laravel core class dependency resolution

In Laravel source code Application.php what does this method actually do - public function registerCoreContainerAliases()

{

    $aliases = [

         'cache'                => ['Illuminate\Cache\CacheManager', 'Illuminate\Contracts\Cache\Factory'],
         'cache.store'          => ['Illuminate\Cache\Repository', 'Illuminate\Contracts\Cache\Repository'],

    ];

}

Is it resolving dependency for the Laravel core classes like cache ? When we are passing the contract as an array eg. ['Illuminate\Cache\CacheManager', 'Illuminate\Contracts\Cache\Factory'] , does it mean that even if the contract ( which basically is an interface ) needs to be resolved then Laravel will inject an instance of the class given alongside in the array.

And what is cache.store and how is it different from cache. As I can see both resolve to different class.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1Z5Y45E
via IFTTT

Aucun commentaire:

Enregistrer un commentaire