Skip to content

Commit

Permalink
Zf3 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielss89 committed Mar 11, 2018
1 parent 5a03e4f commit 00b20b1
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 10 deletions.
10 changes: 0 additions & 10 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
*/

return [
'lazy_services' => array(
'class_map' => array(
\Eye4web\SiteConfig\Service\SiteConfigService::class => \Eye4web\SiteConfig\Service\SiteConfigService::class,
),
),
'service_manager' => [
'factories' => [
\Eye4web\SiteConfig\Config\Config::class => \Eye4web\SiteConfig\Factory\Config\ConfigFactory::class,
Expand All @@ -34,11 +29,6 @@
'initializers' => [
\Eye4web\SiteConfig\Initializer\SiteConfigServiceInitializer::class,
],
'delegators' => array(
\Eye4web\SiteConfig\Service\SiteConfigService::class => array(
'LazyServiceFactory'
),
),
],
'view_helpers' => [
'factories' => [
Expand Down
14 changes: 14 additions & 0 deletions src/Eye4web/SiteConfig/Factory/Config/ConfigFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@
use Eye4web\SiteConfig\Config\Config;
use Eye4web\SiteConfig\Options\ModuleOptions;
use Eye4web\SiteConfig\Reader\ReaderInterface;
use Interop\Container\ContainerInterface;
use Zend\Config\Factory;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\FactoryInterface as LegacyFactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

if (!\interface_exists(FactoryInterface::class)) {
\class_alias(LegacyFactoryInterface::class, FactoryInterface::class);
}

class ConfigFactory implements FactoryInterface
{
private $configFactory = null;
Expand Down Expand Up @@ -68,6 +74,14 @@ public function createService(ServiceLocatorInterface $serviceLocator)
return new Config($data);
}

/**
* {@inheritdoc}
*/
public function __invoke(ContainerInterface $serviceLocator, $requestedName, array $options = null)
{
return $this->createService($serviceLocator);
}

public function getConfigFactory()
{
if (!$this->configFactory) {
Expand Down
14 changes: 14 additions & 0 deletions src/Eye4web/SiteConfig/Factory/Options/ModuleOptionsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@
namespace Eye4web\SiteConfig\Factory\Options;

use Eye4web\SiteConfig\Options\ModuleOptions;
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\ServiceManager\FactoryInterface as LegacyFactoryInterface;

if (!\interface_exists(FactoryInterface::class)) {
\class_alias(LegacyFactoryInterface::class, FactoryInterface::class);
}

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

return $service;
}

/**
* {@inheritdoc}
*/
public function __invoke(ContainerInterface $serviceLocator, $requestedName, array $options = null)
{
return $this->createService($serviceLocator);
}
}
14 changes: 14 additions & 0 deletions src/Eye4web/SiteConfig/Factory/Reader/DoctrineORMReaderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@
use Doctrine\ORM\EntityManager;
use Eye4web\SiteConfig\Options\ModuleOptions;
use Eye4web\SiteConfig\Reader\DoctrineORMReader;
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\ServiceManager\FactoryInterface as LegacyFactoryInterface;

if (!\interface_exists(FactoryInterface::class)) {
\class_alias(LegacyFactoryInterface::class, FactoryInterface::class);
}

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

return $reader;
}

/**
* {@inheritdoc}
*/
public function __invoke(ContainerInterface $serviceLocator, $requestedName, array $options = null)
{
return $this->createService($serviceLocator);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

use Eye4web\SiteConfig\Service\SiteConfigAwareInterface;
use Eye4web\SiteConfig\Service\SiteConfigService;
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\InitializerInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

Expand All @@ -36,4 +37,9 @@ public function initialize($instance, ServiceLocatorInterface $serviceLocator)
$instance->setSiteConfigService($siteConfigService);
}
}

public function __invoke(ContainerInterface $container, $instance)
{
$this->initialize($instance, $container);
}
}

0 comments on commit 00b20b1

Please sign in to comment.