You are here

public function ProxyLogicTest::setProxyValue in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php \Doctrine\Tests\Common\Proxy\ProxyLogicTest::setProxyValue()

Sets a value in the current proxy object without triggering lazy loading through `__set`

@link https://bugs.php.net/bug.php?id=63463

Parameters

string $property:

mixed $value:

File

vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php, line 701

Class

ProxyLogicTest
Test the generated proxies behavior. These tests make assumptions about the structure of LazyLoadableObject

Namespace

Doctrine\Tests\Common\Proxy

Code

public function setProxyValue($property, $value) {
  $reflectionProperty = new \ReflectionProperty($this->lazyObject, $property);
  $initializer = $this->lazyObject
    ->__getInitializer();

  // disabling initializer since setting `publicPersistentField` triggers `__set`/`__get`
  $this->lazyObject
    ->__setInitializer(null);
  $reflectionProperty
    ->setValue($this->lazyObject, $value);
  $this->lazyObject
    ->__setInitializer($initializer);
}