Exemplo n.º 1
0
 public function save(Application_Model_Idea $idea)
 {
     //For debugging
     $this->_logger = new Zend_Log();
     $writer = new Zend_Log_Writer_Stream('sample.log');
     $this->_logger->addWriter($writer);
     $this->_logger->log('here2', Zend_Log::INFO);
     $data = array('destination' => $idea->getDestination(), 'title' => $idea->getTitle(), 'start_date' => $idea->getStartDate(), 'end_date' => $idea->getEndDate(), 'author_id' => $idea->getAuthor()->getId());
     $this->_logger->log('author ID = ' . $idea->getAuthor()->getId(), Zend_Log::INFO);
     if (null === ($id = $idea->getId())) {
         unset($data['idea_id']);
         return $this->getDbTable()->insert($data);
     } else {
         return $this->getDbTable()->update($data, array('idea_id = ?' => $id));
     }
 }