Neos\Flow\Tests\Functional\Persistence\Fixtures\ExtendedTypesEntity::setCommonObject PHP Method

setCommonObject() public method

public setCommonObject ( CommonObject $commonObject = null )
$commonObject CommonObject
    public function setCommonObject(CommonObject $commonObject = null)
    {
        $this->commonObject = $commonObject;
        return $this;
    }

Usage Example

 /**
  * @test
  */
 public function commonObjectIsPersistedAndIsReconstituted()
 {
     if ($this->objectManager->get(ConfigurationManager::class)->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow.persistence.backendOptions.driver') === 'pdo_pgsql') {
         $this->markTestSkipped('Doctrine ORM on PostgreSQL cannot store serialized data, thus storing objects with Type::OBJECT would fail. See http://www.doctrine-project.org/jira/browse/DDC-3241');
     }
     $commonObject = new Fixtures\CommonObject();
     $commonObject->setFoo('foo');
     $extendedTypesEntity = new Fixtures\ExtendedTypesEntity();
     $extendedTypesEntity->setCommonObject($commonObject);
     $this->persistenceManager->add($extendedTypesEntity);
     $this->persistenceManager->persistAll();
     $this->persistenceManager->clearState();
     /**  @var Fixtures\ExtendedTypesEntity $persistedExtendedTypesEntity */
     $persistedExtendedTypesEntity = $this->extendedTypesEntityRepository->findAll()->getFirst();
     $this->assertInstanceOf(Fixtures\ExtendedTypesEntity::class, $persistedExtendedTypesEntity);
     $this->assertInstanceOf(Fixtures\CommonObject::class, $persistedExtendedTypesEntity->getCommonObject());
     $this->assertEquals('foo', $persistedExtendedTypesEntity->getCommonObject()->getFoo());
 }