persist() public method

The entity will be entered into the filesystem at or before transaction commit or as a result of the flush operation. NOTE: The persist operation always considers entities that are not yet known to this XmlEntityManager as NEW. Do not pass detached entities to the persist operation.
public persist ( $entity )
Exemplo n.º 1
0
 public function testObjectFlushPerPersist()
 {
     for ($i = 1; $i <= 10; $i++) {
         $simple = new SimpleWithField();
         $simple->id = $i;
         $this->xem->persist($simple);
         $this->xem->flush();
         $filepath = __DIR__ . "/../Workspace/Doctrine/Tests/OXM/Entities/SimpleWithField/{$i}.xml";
         $this->assertFileExists($filepath);
         $this->assertXmlStringEqualsXmlFile($filepath, '<?xml version="1.0" encoding="UTF-8"?><simple-with-field id="' . $i . '"/>');
         unlink($filepath);
     }
 }