public function save(EntityInterface $notes) { $notesData = array('user_id' => $notes->getUserId(), 'user_username' => $notes->getUserName(), 'status' => $notes->getStatus(), 'title' => $notes->getTitle(), 'content' => $notes->getContent()); if ($notes->getNotesId()) { $notesData['updated_at'] = date("Y-m-d H:i:s", time()); $notesData['created_at'] = $notes->getCreatedAt(); $this->db->update('sticky_notes', $notesData, array('notes_id' => $notes->getNotesId())); } else { $notesData['updated_at'] = date("Y-m-d H:i:s", time()); $notesData['created_at'] = date("Y-m-d H:i:s", time()); $this->db->insert('sticky_notes', $notesData); $id = $this->db->lastInsertId(); $notes->setNotesId($id); } return null; }
/** * @param Todo $entity */ public function isSatisfiedBy(EntityInterface $entity) { assert($entity instanceof Todo); return $entity->getStatus()->isCompleted(); }