Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Deprecate Proxy auto-generation #5858

Merged
merged 9 commits into from

4 participants

@Ocramius
Collaborator

Supersedes #5198

Ping @blanchonvincent

@Ocramius Ocramius referenced this pull request
Closed

ProxyManager bugfix #5198

...erviceManager/Proxy/LazyServiceFactoryFactoryTest.php
@@ -140,6 +140,42 @@ public function testRegistersAutoloader()
spl_autoload_unregister($proxyAutoloader);
}
+ public function testDontAutoGenerateProxyFiles()
+ {
+ $serviceManager = new ServiceManager();
+ $namespace = 'ZendTestProxy' . uniqid();
+
+ $serviceManager->setService(
+ 'Config',
+ array(
+ 'lazy_services' => array(
+ 'class_map' => array('foo' => __CLASS__),
+ 'proxies_namespace' => $namespace,
+ 'write_proxy_files' => true,
+ 'auto_generate_proxies' => true,
@Maks3w Collaborator
Maks3w added a note

Should be this false?

@Ocramius Collaborator

No, otherwise it would fallback to the eval() logic (and not write the file to disk). I probably need to fix the test method or see if it is not redundant

@Ocramius Collaborator

Yes, the test is redundant, as well as the config flag. Simply dropping them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Maks3w Maks3w added this to the 2.3.0 milestone
@Maks3w
Collaborator

@Ocramius Please review the travis report. There is some problem with composer dependencies

@Ocramius
Collaborator

Saw that - cannot really fix as it seems, since it doesn't consider the dev branch of zf a 2.* (required by proxy-manager). I will diff the composer.json first

@Ocramius
Collaborator

@Maks3w yes, verified. This PR can't have green on travis because the packagist.org definitions still tell that the repository requires ocramius/proxy-manager:0.4.*.

This will get green once merged, the subtree split happened, and packagist updated its internal definitions

@Maks3w Maks3w merged commit b610d96 into zendframework:develop

1 check failed

Details default The Travis CI build could not complete due to an error
@bakura10 bakura10 commented on the diff
...nd/ServiceManager/Proxy/LazyServiceFactoryFactory.php
@@ -51,22 +55,7 @@ public function createService(ServiceLocatorInterface $serviceLocator)
$factoryConfig->setGeneratorStrategy(new EvaluatingGeneratorStrategy());
}
- if (isset($lazyServices['auto_generate_proxies'])) {

Some options seems to be gone. Can you update the doc ?

@Ocramius Collaborator

Doing that nao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Ocramius Ocramius deleted the Ocramius:hotfix/proxy-auto-generation branch
@Ocramius Ocramius referenced this pull request in zendframework/zf2-documentation
Merged

Removing `auto_generate_proxies` from config example #1212

@gianarb gianarb referenced this pull request from a commit in zendframework/zend-servicemanager
@Maks3w Maks3w Merge pull request zendframework/zf2#5858 from Ocramius/hotfix/proxy-…
…auto-generation

Deprecate Proxy auto-generation. Close zendframework/zf2#5198
1a30196
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
2  composer.json
@@ -37,7 +37,7 @@
"ircmaxell/random-lib": "dev-master",
"ircmaxell/security-lib": "dev-master",
"mikey179/vfsStream": "1.2.*",
- "ocramius/proxy-manager": "0.4.*",
+ "ocramius/proxy-manager": "0.5.*",
"fabpot/php-cs-fixer": "*@dev",
"phpunit/PHPUnit": "3.7.*",
"satooshi/php-coveralls": "dev-master",
View
21 library/Zend/ServiceManager/Proxy/LazyServiceFactoryFactory.php
@@ -43,6 +43,10 @@ public function createService(ServiceLocatorInterface $serviceLocator)
$factoryConfig = new Configuration();
+ if (isset($lazyServices['proxies_namespace'])) {
+ $factoryConfig->setProxiesNamespace($lazyServices['proxies_namespace']);
+ }
+
if (isset($lazyServices['proxies_target_dir'])) {
$factoryConfig->setProxiesTargetDir($lazyServices['proxies_target_dir']);
}
@@ -51,22 +55,7 @@ public function createService(ServiceLocatorInterface $serviceLocator)
$factoryConfig->setGeneratorStrategy(new EvaluatingGeneratorStrategy());
}
- if (isset($lazyServices['auto_generate_proxies'])) {

Some options seems to be gone. Can you update the doc ?

@Ocramius Collaborator

Doing that nao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
- $factoryConfig->setAutoGenerateProxies($lazyServices['auto_generate_proxies']);
-
- // register the proxy autoloader if the proxies already exist
- if (!$lazyServices['auto_generate_proxies']) {
- spl_autoload_register($factoryConfig->getProxyAutoloader());
-
- $factoryConfig->setGeneratorStrategy(new EvaluatingGeneratorStrategy());
- }
- }
-
- //if (!isset($lazyServicesConfig['runtime_evaluate_proxies']))
-
- if (isset($lazyServices['proxies_namespace'])) {
- $factoryConfig->setProxiesNamespace($lazyServices['proxies_namespace']);
- }
+ spl_autoload_register($factoryConfig->getProxyAutoloader());
return new LazyServiceFactory(new LazyLoadingValueHolderFactory($factoryConfig), $lazyServices['class_map']);
}
View
1  tests/ZendTest/ServiceManager/Proxy/LazyServiceFactoryFactoryTest.php
@@ -124,7 +124,6 @@ public function testRegistersAutoloader()
'lazy_services' => array(
'class_map' => array('foo' => __CLASS__),
'proxies_namespace' => $namespace,
- 'auto_generate_proxies' => false,
),
)
);
Something went wrong with that request. Please try again.