/** * Update record. * * @param EntityInterface $entity * @return mixed Returns either `FALSE` or {@see \odTimeTracker\Model\ProjectEntity}. */ public function update(EntityInterface $entity) { $sql = <<<EOT UPDATE `{$this->tableName}` SET \t`Name` = :name , \t`Description` = :description , \t`Created` = :created WHERE `ProjectId` = :id EOT; $stmt = $this->pdo->prepare($sql); $stmt->bindParam(':id', $entity->getProjectId(), \PDO::PARAM_INT); $stmt->bindParam(':name', $entity->getName(), \PDO::PARAM_STR); $stmt->bindParam(':description', $entity->getDescription(), \PDO::PARAM_STR); $stmt->bindParam(':created', $entity->getCreatedRfc3339(), \PDO::PARAM_STR); $res = $stmt->execute(); if ($res === false || $stmt->rowCount() !== 1) { return false; } return $entity; }