Neos\Flow\Tests\Functional\Persistence\Fixtures\TestEntity::setArrayProperty PHP Метод

setArrayProperty() публичный Метод

public setArrayProperty ( array $arrayProperty ) : void
$arrayProperty array
Результат void
    public function setArrayProperty($arrayProperty)
    {
        $this->arrayProperty = $arrayProperty;
    }

Usage Example

 /**
  * @test
  */
 public function persistedEntitiesLyingInArraysAreNotSerializedButReferencedByTheirIdentifierAndReloadedFromPersistenceOnWakeup()
 {
     $testEntityLyingInsideTheArray = new Fixtures\TestEntity();
     $testEntityLyingInsideTheArray->setName('Flow');
     $arrayProperty = ['some' => ['nestedArray' => ['key' => $testEntityLyingInsideTheArray]]];
     $testEntityWithArrayProperty = new Fixtures\TestEntity();
     $testEntityWithArrayProperty->setName('dummy');
     $testEntityWithArrayProperty->setArrayProperty($arrayProperty);
     $this->testEntityRepository->add($testEntityLyingInsideTheArray);
     $this->testEntityRepository->add($testEntityWithArrayProperty);
     $this->persistenceManager->persistAll();
     $serializedData = serialize($testEntityWithArrayProperty);
     $testEntityLyingInsideTheArray->setName('Neos');
     $this->persistenceManager->persistAll();
     $testEntityWithArrayPropertyUnserialized = unserialize($serializedData);
     $arrayPropertyAfterUnserialize = $testEntityWithArrayPropertyUnserialized->getArrayProperty();
     $this->assertNotSame($testEntityWithArrayProperty, $testEntityWithArrayPropertyUnserialized);
     $this->assertEquals('Neos', $arrayPropertyAfterUnserialize['some']['nestedArray']['key']->getName(), 'The entity inside the array property has not been updated to the current persistend state after wakeup.');
 }