exportRecord() public méthode

public exportRecord ( BaseModel $record ) : DOMDocument
$record LazyRecord\BaseModel
Résultat DOMDocument
 public function testRecursiveExporting()
 {
     $author = new Author();
     $ret = $author->create(array('name' => 'Z', 'email' => 'z@z', 'identity' => 'z'));
     $this->assertResultSuccess($ret);
     // Has Many Relationship
     $author->addresses->create(['address' => 'far far away']);
     $author->addresses->create(['address' => 'taipei 101']);
     $author->addresses->create(['address' => 'brazil']);
     $author->addresses->create(['address' => 'san francisco']);
     $book = new Book();
     $ret = $book->create(['title' => 'Run & Skate']);
     $this->assertResultSuccess($ret);
     // ManyToMany
     $author->author_books->create(['book_id' => $book->id]);
     $book = new Book();
     $ret = $book->create(['title' => 'Run & Skate II']);
     $this->assertResultSuccess($ret);
     $author->author_books->create(['book_id' => $book->id]);
     $exporter = new XMLExporter();
     $dom = $exporter->exportRecord($author);
     $dom->formatOutput = true;
     $this->assertInstanceOf('DOMDocument', $dom);
     $xml = $dom->saveXML();
     $this->assertNotEmpty($xml);
     // echo $xml;
 }
 public function testRecursiveExporting()
 {
     $author = new Author();
     $ret = $author->create(array('name' => 'Z', 'email' => 'z@z', 'identity' => 'z', 'updated_on' => '2012-01-01 00:00:00', 'created_on' => '2012-01-01 00:00:00'));
     $this->assertResultSuccess($ret);
     // Has Many Relationship
     $author->addresses->create(['address' => 'far far away']);
     $author->addresses->create(['address' => 'taipei 101']);
     $author->addresses->create(['address' => 'brazil']);
     $author->addresses->create(['address' => 'san francisco']);
     $book = new Book();
     $ret = $book->create(['title' => 'Run & Skate', 'published_at' => '2012-01-01 00:00:00', 'updated_on' => '2012-01-01 00:00:00', 'created_on' => '2012-01-01 00:00:00', 'is_selled' => false]);
     $this->assertResultSuccess($ret);
     // ManyToMany
     $author->author_books->create(['book_id' => $book->id, 'created_on' => '2012-01-01 00:00:00']);
     $book = new Book();
     $ret = $book->create(['title' => 'Run & Skate II', 'updated_on' => '2012-01-01 00:00:00', 'created_on' => '2012-01-01 00:00:00', 'published_at' => '2012-01-01 00:00:00', 'is_selled' => false]);
     $this->assertResultSuccess($ret);
     $author->author_books->create(['book_id' => $book->id, 'created_on' => '2012-01-01 00:00:00']);
     $exporter = new XMLExporter();
     $dom = $exporter->exportRecord($author);
     $dom->formatOutput = true;
     $this->assertInstanceOf('DOMDocument', $dom);
     $xml = $dom->saveXML();
     $this->assertNotEmpty($xml);
     file_put_contents('tests/xmlTestRecursiveExporting.actual', $xml);
     $this->assertFileEquals('tests/xmlTestRecursiveExporting.expected', 'tests/xmlTestRecursiveExporting.actual');
 }