Example #1
0
 public function save()
 {
     $authorEntity = $this->getAuthor();
     $author = AuthorQuery::create()->filterByName($authorEntity->getName())->findOne();
     if (!$author) {
         $author = new AuthorModel();
         $author->setName($authorEntity->getName());
         $author->save();
     }
     $book = new BookModel();
     $book->setIsbn($this->getIsbn());
     $book->setTitle($this->getTitle());
     $book->setAuthor($author);
     $date = date_create();
     $book->setPublishedOn(date_timestamp_get($date));
     $book->save();
     return $this->serilizeORM($book);
 }
Example #2
0
 /**
  * @param	Book $book The book object to add.
  */
 protected function doAddBook($book)
 {
     $this->collBooks[] = $book;
     $book->setAuthor($this);
 }