You are here

public function ProxyLogicTest::setProxyValue in Plug 7

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

lib/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);
}