-
-
Save Majkl578/61731254ea9d36f2f32778d357ff4f5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Doctrine\Tests\ORM\Functional\Ticket; | |
use Doctrine\Tests\ORM\Functional\SecondLevelCacheAbstractTest; | |
class DDC5808Test extends SecondLevelCacheAbstractTest | |
{ | |
protected function setUp() | |
{ | |
parent::setUp(); | |
$this->_em->getCache()->evictEntityRegion(__NAMESPACE__ . '\DDC5808Geoinformation'); | |
$this->_em->getCache()->evictEntityRegion(__NAMESPACE__ . '\DDC5808GeoinformationMetaData'); | |
$this->_em->clear(); | |
} | |
public function testIssue() | |
{ | |
$this->_schemaTool->createSchema(array( | |
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC5808Geoinformation'), | |
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC5808GeoinformationMetaData'), | |
)); | |
$geo = new DDC5808Geoinformation(); | |
$geo->id = 1; | |
$geoMetadata = new DDC5808GeoinformationMetaData(); | |
$geoMetadata->id = 2; | |
$geo->metaData = $geoMetadata; | |
$geoMetadata->geoinformation = $geo; | |
$this->_em->persist($geo); | |
$this->_em->persist($geoMetadata); | |
$this->_em->flush(); | |
$this->_em->clear(); | |
// no cache | |
$this->_em->find(__NAMESPACE__ . '\\DDC5808Geoinformation', 1); | |
$this->_em->clear(); | |
// cache | |
$this->assertInstanceOf(__NAMESPACE__ . '\\DDC5808Geoinformation', $this->_em->find(__NAMESPACE__ . '\\DDC5808Geoinformation', 1)); | |
} | |
} | |
/** | |
* @Entity | |
* @Table | |
* @Cache(usage="NONSTRICT_READ_WRITE", region="geoinformation_region") | |
*/ | |
class DDC5808Geoinformation | |
{ | |
/** | |
* @Id | |
* @Column(type="integer") | |
*/ | |
public $id; | |
/** | |
* @OneToOne(targetEntity="DDC5808GeoinformationMetaData", inversedBy="geoinformation", cascade={"persist"}) | |
* @JoinColumn(name="geoinformation_meta_data_id", referencedColumnName="id") | |
* @Cache(usage="NONSTRICT_READ_WRITE", region="geoinformation_region") | |
*/ | |
public $metaData; | |
} | |
/** | |
* @Entity | |
* @Table | |
* @Cache(usage="NONSTRICT_READ_WRITE", region="geoinformation_region") | |
*/ | |
class DDC5808GeoinformationMetaData | |
{ | |
/** | |
* @Id | |
* @Column(type="integer") | |
*/ | |
public $id; | |
/** | |
* @OneToOne(targetEntity="DDC5808Geoinformation", mappedBy="metaData") | |
*/ | |
public $geoinformation; | |
/** | |
* @Column(nullable=true) | |
*/ | |
public $foo; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment