getCache() public method

Get caching service
public getCache ( ) : Bravo3\Orm\Services\Cache\EntityCachingInterface
return Bravo3\Orm\Services\Cache\EntityCachingInterface
コード例 #1
0
ファイル: EntityManagerTest.php プロジェクト: bravo3/orm
 /**
  * @dataProvider entityManagerDataProvider
  * @param EntityManager $em
  */
 public function testCacheIndex(EntityManager $em)
 {
     $product = new IndexedEntity();
     $product->setId1(212)->setId2('test')->setAlpha('index-test')->setBravo(888);
     $em->persist($product)->flush();
     $r = $em->retrieve(IndexedEntity::class, '212.test');
     $r->setBravo(999);
     $r1 = $em->retrieveByIndex(IndexedEntity::class, 'ab', 'index-test.888');
     $this->assertEquals(999, $r1->getBravo());
     $r2 = $em->retrieveByIndex(IndexedEntity::class, 'ab', 'index-test.888', false);
     $this->assertEquals(888, $r2->getBravo());
     $em->getCache()->purge(IndexedEntity::class, '212.test');
     $r3 = $em->retrieveByIndex(IndexedEntity::class, 'ab', 'index-test.888');
     $this->assertEquals(888, $r3->getBravo());
 }