コード例 #1
0
 /**
  * Just make one field of a document untranslated again
  */
 public function testPartialUntranslateChild()
 {
     $article = new ChildTranslationArticle();
     $article->id = '/functional/convert';
     $article->topic = 'Some interesting subject';
     $article->setText('Lorem ipsum...');
     $this->dm->persist($article);
     $this->dm->flush();
     $this->dm->clear();
     $class = 'Doctrine\\Tests\\Models\\Translation\\ChildTranslationArticle';
     $field = 'author';
     $node = $this->node->getNode('convert');
     $node->getNode('phpcr_locale:en')->setProperty($field, 'Move to untranslated');
     $this->session->save();
     $this->assertFalse($this->converter->convert($class, array('en'), array($field)));
     $this->session->save();
     $this->dm->clear();
     $this->dm = $this->createDocumentManager();
     $this->dm->setLocaleChooserStrategy(new LocaleChooser($this->localePrefs, 'en'));
     $this->assertTrue($node->hasProperty($field), 'new property was not created');
     $this->assertTrue($node->hasNode('phpcr_locale:en'), 'lost translation');
     $this->assertFalse($node->getNode('phpcr_locale:en')->hasProperty($field), 'old property was not removed');
     $article = $this->dm->find(null, '/functional/convert');
     $this->assertInstanceof($class, $article);
     $this->assertEquals('Move to untranslated', $article->author);
     $this->assertEquals('Lorem ipsum...', $article->getText());
     $this->dm->clear();
     $article = $this->dm->find(null, '/functional/convert');
     $this->assertInstanceof($class, $article);
     $this->assertEquals('Move to untranslated', $article->author);
     $this->assertEquals('Lorem ipsum...', $article->getText());
 }
コード例 #2
0
 /**
  * {@inheritDoc}
  */
 public function persist($document)
 {
     $this->wrapped->persist($document);
 }