/**
  * 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 addCategory($category)
 {
     $cat_id = Category::getCategoryId($category) ?: Category::addCategory($this->_dbh, $category);
     $this->_dbh->query("INSERT INTO rel_book_category (book, category) VALUES (?, ?)", array($this->id, $cat_id));
 }