/** * @param OnpubSAMap $samap The map to be updated. * @return int 1 if the map was updated. 0 if the map does not exist in the database. */ public function update(OnpubSAMap $samap) { $stmt = $this->pdo->prepare("UPDATE OnpubSAMaps SET sectionID = :sectionID, articleID = :articleID, created = :created, modified = :modified WHERE ID = :ID"); OnpubDatabase::verifyPrepare($this->pdo, $stmt, $this->enableTransactions); $ID = $samap->ID; $sectionID = $samap->sectionID; $articleID = $samap->articleID; $created = $samap->getCreated()->format('Y-m-d H:i:s'); $modified = $samap->getModified()->format('Y-m-d H:i:s'); $stmt->bindParam(':ID', $ID); $stmt->bindParam(':sectionID', $sectionID); $stmt->bindParam(':articleID', $articleID); $stmt->bindParam(':created', $created); $stmt->bindParam(':modified', $modified); $result = $stmt->execute(); OnpubDatabase::verifyExecute($this->pdo, $result, $this->enableTransactions, $stmt->errorInfo()); return $stmt->rowCount(); }