Skip to content

Commit 00b20b1

Browse files
committed
Zf3 fixes
1 parent 5a03e4f commit 00b20b1

File tree

5 files changed

+48
-10
lines changed

5 files changed

+48
-10
lines changed

config/module.config.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818
*/
1919

2020
return [
21-
'lazy_services' => array(
22-
'class_map' => array(
23-
\Eye4web\SiteConfig\Service\SiteConfigService::class => \Eye4web\SiteConfig\Service\SiteConfigService::class,
24-
),
25-
),
2621
'service_manager' => [
2722
'factories' => [
2823
\Eye4web\SiteConfig\Config\Config::class => \Eye4web\SiteConfig\Factory\Config\ConfigFactory::class,
@@ -34,11 +29,6 @@
3429
'initializers' => [
3530
\Eye4web\SiteConfig\Initializer\SiteConfigServiceInitializer::class,
3631
],
37-
'delegators' => array(
38-
\Eye4web\SiteConfig\Service\SiteConfigService::class => array(
39-
'LazyServiceFactory'
40-
),
41-
),
4232
],
4333
'view_helpers' => [
4434
'factories' => [

src/Eye4web/SiteConfig/Factory/Config/ConfigFactory.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,16 @@
2222
use Eye4web\SiteConfig\Config\Config;
2323
use Eye4web\SiteConfig\Options\ModuleOptions;
2424
use Eye4web\SiteConfig\Reader\ReaderInterface;
25+
use Interop\Container\ContainerInterface;
2526
use Zend\Config\Factory;
2627
use Zend\ServiceManager\FactoryInterface;
28+
use Zend\ServiceManager\FactoryInterface as LegacyFactoryInterface;
2729
use Zend\ServiceManager\ServiceLocatorInterface;
2830

31+
if (!\interface_exists(FactoryInterface::class)) {
32+
\class_alias(LegacyFactoryInterface::class, FactoryInterface::class);
33+
}
34+
2935
class ConfigFactory implements FactoryInterface
3036
{
3137
private $configFactory = null;
@@ -68,6 +74,14 @@ public function createService(ServiceLocatorInterface $serviceLocator)
6874
return new Config($data);
6975
}
7076

77+
/**
78+
* {@inheritdoc}
79+
*/
80+
public function __invoke(ContainerInterface $serviceLocator, $requestedName, array $options = null)
81+
{
82+
return $this->createService($serviceLocator);
83+
}
84+
7185
public function getConfigFactory()
7286
{
7387
if (!$this->configFactory) {

src/Eye4web/SiteConfig/Factory/Options/ModuleOptionsFactory.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,14 @@
2020
namespace Eye4web\SiteConfig\Factory\Options;
2121

2222
use Eye4web\SiteConfig\Options\ModuleOptions;
23+
use Interop\Container\ContainerInterface;
2324
use Zend\ServiceManager\FactoryInterface;
2425
use Zend\ServiceManager\ServiceLocatorInterface;
26+
use Zend\ServiceManager\FactoryInterface as LegacyFactoryInterface;
27+
28+
if (!\interface_exists(FactoryInterface::class)) {
29+
\class_alias(LegacyFactoryInterface::class, FactoryInterface::class);
30+
}
2531

2632
class ModuleOptionsFactory implements FactoryInterface
2733
{
@@ -43,4 +49,12 @@ public function createService(ServiceLocatorInterface $serviceLocator)
4349

4450
return $service;
4551
}
52+
53+
/**
54+
* {@inheritdoc}
55+
*/
56+
public function __invoke(ContainerInterface $serviceLocator, $requestedName, array $options = null)
57+
{
58+
return $this->createService($serviceLocator);
59+
}
4660
}

src/Eye4web/SiteConfig/Factory/Reader/DoctrineORMReaderFactory.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,14 @@
2222
use Doctrine\ORM\EntityManager;
2323
use Eye4web\SiteConfig\Options\ModuleOptions;
2424
use Eye4web\SiteConfig\Reader\DoctrineORMReader;
25+
use Interop\Container\ContainerInterface;
2526
use Zend\ServiceManager\FactoryInterface;
2627
use Zend\ServiceManager\ServiceLocatorInterface;
28+
use Zend\ServiceManager\FactoryInterface as LegacyFactoryInterface;
29+
30+
if (!\interface_exists(FactoryInterface::class)) {
31+
\class_alias(LegacyFactoryInterface::class, FactoryInterface::class);
32+
}
2733

2834
class DoctrineORMReaderFactory implements FactoryInterface
2935
{
@@ -41,4 +47,12 @@ public function createService(ServiceLocatorInterface $serviceLocator)
4147

4248
return $reader;
4349
}
50+
51+
/**
52+
* {@inheritdoc}
53+
*/
54+
public function __invoke(ContainerInterface $serviceLocator, $requestedName, array $options = null)
55+
{
56+
return $this->createService($serviceLocator);
57+
}
4458
}

src/Eye4web/SiteConfig/Initializer/SiteConfigServiceInitializer.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
use Eye4web\SiteConfig\Service\SiteConfigAwareInterface;
2323
use Eye4web\SiteConfig\Service\SiteConfigService;
24+
use Interop\Container\ContainerInterface;
2425
use Zend\ServiceManager\InitializerInterface;
2526
use Zend\ServiceManager\ServiceLocatorInterface;
2627

@@ -36,4 +37,9 @@ public function initialize($instance, ServiceLocatorInterface $serviceLocator)
3637
$instance->setSiteConfigService($siteConfigService);
3738
}
3839
}
40+
41+
public function __invoke(ContainerInterface $container, $instance)
42+
{
43+
$this->initialize($instance, $container);
44+
}
3945
}

0 commit comments

Comments
 (0)