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