/** * API_Scraper constructor. * @param Base_PDO $_dbh */ public function __construct(Base_PDO $_dbh) { $this->_client = new Google_Client(); $this->_client->setApplicationName(self::$PROJECT_NAME); $this->_client->setDeveloperKey(self::$API_KEY); $this->_api_service = new Google_Service_Books($this->_client); $this->_dbh = $_dbh; Author::getAllAuthors($this->_dbh); Category::getAllCategories($this->_dbh); }
public function addAuthor($author) { $author_id = Author::getAuthorId($author) ?: Author::addAuthor($this->_dbh, $author); $this->_dbh->query("INSERT INTO rel_book_author (book, author) VALUES (?, ?)", array($this->id, $author_id)); }