All factories have to implement the __invoke() function. We have a lot of factories looking like:
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
class FooFactory implements FactoryInterface
{
public function createService(ServiceLocatorInterface $services)
{
return new Foo($services->get(Bar::class));
}
}
these have to be changed to look like
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
class FooFactory implements FactoryInterface
{
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
return new Foo($container->get(Bar::class));
}
public function createService(ServiceLocatorInterface $services)
{
return $this($services, Foo::class);
}
}
ZF3 Upgrade
All factories have to implement the __invoke() function. We have a lot of factories looking like:
these have to be changed to look like