/** * Get a full UserEvent object related to a book with all members initialised * This is necessary for storing the object in cache otherwise when getting the object from cahc (and detach from database) * these members won't be initialized * @param \Sb\Db\Model\UserEvent $event */ private function getFullBookRelatedUserEvent(UserEvent $event) { // If item_id is not null, we get the userbook item from db if ($event->getItem_id()) { $userbook = UserBookDao::getInstance()->get($event->getItem_id()); if ($userbook) { $book = $userbook->getBook(); $contributors = \Sb\Db\Dao\ContributorDao::getInstance()->getListForBook($book->getId()); $book->setContributors($contributors); $event->setBook($book); } return $event; } else { return $event; } }
public function setBook($book) { $this->__load(); return parent::setBook($book); }