Neos\Flow\Tests\Functional\Persistence\PersistenceTest::persistedEntitiesLyingInArraysAreNotSerializedButReferencedByTheirIdentifierAndReloadedFromPersistenceOnWakeup PHP Method

persistedEntitiesLyingInArraysAreNotSerializedButReferencedByTheirIdentifierAndReloadedFromPersistenceOnWakeup() public method

    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.');
    }
PersistenceTest