Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Update zend-mvc v2 to use zend-servicemanager-di #158

Merged
merged 2 commits into from
Jun 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ language: php

branches:
except:
- /^release-.*$/
- /^release-\d+\.\d+\.\d+.*$/
- /^ghgfk-.*$/

cache:
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"php": "^5.5 || ^7.0",
"zendframework/zend-eventmanager": "^2.6.2 || ^3.0",
"zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3",
"zendframework/zend-servicemanager-di": "^1.0.1",
"zendframework/zend-hydrator": "^1.1 || ^2.1",
"zendframework/zend-form": "^2.7",
"zendframework/zend-stdlib": "^2.7.5 || ^3.0",
Expand Down
255 changes: 153 additions & 102 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 11 additions & 37 deletions src/Service/DiAbstractServiceFactoryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,17 @@

namespace Zend\Mvc\Service;

use Interop\Container\ContainerInterface;
use Zend\ServiceManager\Di\DiAbstractServiceFactory;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\ServiceManager\ServiceManager;
use Zend\ServiceManager\Di\DiAbstractServiceFactoryFactory as OriginalFactory;

class DiAbstractServiceFactoryFactory implements FactoryInterface
/**
* Since 2.7.9, this class now extends the version defined in zend-servicemanager-di,
* ensuring backwards compatibility with zend-servicemanger v2 and forwards
* compatibility with zend-servicemanager v3.
*
* @deprecated Since 2.7.9. The factory is now defined in zend-servicemanager-di,
* and removed in 3.0.0. Use Zend\ServiceManager\Di\DiAbstractServiceFactoryFactory
* from zend-servicemanager-di instead if you rely on this feature.
*/
class DiAbstractServiceFactoryFactory extends OriginalFactory
{
/**
* Class responsible for instantiating a DiAbstractServiceFactory
*
* @param ContainerInterface $container
* @param string $name
* @param null|array $options
* @return DiAbstractServiceFactory
*/
public function __invoke(ContainerInterface $container, $name, array $options = null)
{
$factory = new DiAbstractServiceFactory($container->get('Di'), DiAbstractServiceFactory::USE_SL_BEFORE_DI);

if ($serviceLocator instanceof ServiceManager) {
$serviceLocator->addAbstractFactory($factory, false);
}

return $factory;
}

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