예제 #1
0
 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;
 }
예제 #2
0
 public function save(EntityInterface $event)
 {
     $eventData = array('user_id' => $event->getUserId(), 'username' => $event->getUserName(), 'title_status' => $event->getTitleStatus(), 'title' => $event->getTitle(), 'event_name' => $event->getEventName(), 'event_status' => $event->getEventStatus(), 'description' => $event->getDescription());
     if ($event->getId()) {
         $eventData['updated_at'] = date("Y-m-d H:i:s", time());
         $eventData['created_at'] = $event->getCreatedAt();
         $this->db->update('events', $eventData, array('id' => $event->getId()));
     } else {
         $eventData['updated_at'] = date("Y-m-d H:i:s", time());
         $eventData['created_at'] = date("Y-m-d H:i:s", time());
         $this->db->insert('events', $eventData);
         $id = $this->db->lastInsertId();
         $event->setId($id);
     }
     return null;
 }