#17676 - making the proxy instantiation compatible with ProxyManager 2.x by detecting proxy features
This commit is contained in:
parent
b9cd91d342
commit
a8f1a10e9e
@ -119,8 +119,6 @@ EOF;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Definition $definition
|
||||
*
|
||||
* @return ClassGenerator
|
||||
*/
|
||||
private function generateProxyClass(Definition $definition)
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy\Dumper;
|
||||
|
||||
use ProxyManager\ProxyGenerator\LazyLoading\MethodGenerator\StaticProxyConstructor;
|
||||
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
|
||||
@ -49,8 +50,7 @@ class PhpDumperTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testDumpContainerWithProxyServiceWillShareProxies()
|
||||
{
|
||||
// detecting ProxyManager v2
|
||||
if (class_exists('ProxyManager\ProxyGenerator\LazyLoading\MethodGenerator\StaticProxyConstructor')) {
|
||||
if (class_exists(StaticProxyConstructor::class)) { // detecting ProxyManager v2
|
||||
require_once __DIR__.'/../Fixtures/php/lazy_service_with_hints.php';
|
||||
} else {
|
||||
require_once __DIR__.'/../Fixtures/php/lazy_service.php';
|
||||
|
@ -38,10 +38,8 @@ class LazyServiceProjectServiceContainer extends Container
|
||||
public function getFooService($lazyLoad = true)
|
||||
{
|
||||
if ($lazyLoad) {
|
||||
$container = $this;
|
||||
|
||||
return $this->services['foo'] = new stdClass_c1d194250ee2e2b7d2eab8b8212368a8(
|
||||
function (&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) use ($container) {
|
||||
function (&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) {
|
||||
$wrappedInstance = $this->getFooService(false);
|
||||
|
||||
$proxy->setProxyInitializer(null);
|
||||
|
Reference in New Issue
Block a user