Question: How can fix it (zend version 2.5) ?

ServiceLocatorAwareInterface is deprecated and will be removed in version 3.0, along with the ServiceLocatorAwareInitializer. Please update your class Teacher\Controller\TeacherController to remove the implementation, and start injecting your dependencies via factory instead

I tried :

```
class TeacherControllerFactory implements FactoryInterface
    {
        public function __invoke(ContainerInterface $container, $name, array $options = null)
        {
            return new TeacherController(
                $container->getServiceLocator()->get(TeacherService::class)
            );
        }

        /**
         * Create and return TeacherController instance
         *
         * For use with zend-servicemanager v2; proxies to __invoke().
         *
         * @param ServiceLocatorInterface $container
         * @return TeacherController
         */
        public function createService(ServiceLocatorInterface $container)
        {
            return $this($container, TeacherController::class);
        }
    }

```

Answer: 
Have a look [here](https://github.com/zendframework/zend-mvc/issues/87). The patch is already merged. Here is the [link to the patch](https://github.com/zendframework/zend-mvc/pull/88).

[This Link](http://www.zfdaily.com/2012/07/getting-dependencies-into-zf2-controllers/) helped me to inject dependencies right.
You need add **~E\_USER\_DEPRECATED** 

You can add in the public/index.php

```
ini_set ( "error_reporting", E_ALL & ~ E_DEPRECATED & ~E_USER_DEPRECATED  & ~ E_STRICT );

```

or

```
error_reporting ( E_ALL & ~ E_DEPRECATED & ~ E_USER_DEPRECATED & ~ E_STRICT );

```

> 
> User-generated warning message. This is like an E\_DEPRECATED, except
>  it is generated in PHP code by using the PHP function trigger\_error().
> 
> 
> 

<http://php.net/manual/en/errorfunc.constants.php>