Search code examples
zend-frameworkzend-framework2zend-form

How to hide zend framework2 Deprecated message


Deprecated: You are retrieving the service locator from within the class Admin\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 /var/www/airtel-emt-credit-limit/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php on line 258


Solution

  • Supress the warnings using error_reporting().

    For example first thing in your application as in your index.php file:

    error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);
    

    All errors will be shown except for deprecated or user_deprecated.