neilime / zf2-assets-bundle

AssetsBundle is a module for Zend Framework 2 allowing asset managment (bundling & caching)
https://neilime.github.io/zf2-assets-bundle/
MIT License
33 stars 20 forks source link

Deprecated when trying to add custom JS #54

Closed wambaloo closed 7 years ago

wambaloo commented 7 years ago

Hi !!

There is a deprecated notice when trying to include custom JS in header.

Deprecated: You are retrieving the service locator from within the class Entities\Controller\IndexController. Please be aware that ServiceLocatorAwareInterface is deprecated and will be removed in version 3.0, along with the ServiceLocatorAwareInitializer. You will need to update your class to accept all dependencies at creation, either via constructor arguments or setters, and use a factory to perform the injections. in C:\wamp64\www\pdl\vendor\zendframework\zend-mvc\src\Controller\AbstractController.php on line 258

when trying to do that in header (like documentation suggest) :

if(is_array($this->jsCustomFiles))foreach($this->jsCustomFiles as $sJsCustomFile){ $this->plugin('InlineScript')->appendFile($sJsCustomFile); }

Maybe I missed something ?

Thanks in advance and thanks for this ZF2 module !!

neilime commented 7 years ago

Hi,

The very last version should fix your issue

wambaloo commented 7 years ago

Nice work !!! thank you very much ! I will open a new ticket I think I found a new bug ;)