Ejemplo n.º 1
0
 public function delete()
 {
     if ($this->_isAllowed()) {
         try {
             $u = new Project_Persist_Dao_Project();
             return $u->delete($this->_project->getId());
         } catch (Exception $e) {
             throw $e;
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Saves a project  entry at storage layer level (insert or update)
  * @param  Project_Model_Project $project
  * @throws Exception if update process failed
  * @return mixed const
  */
 public function save(Project_Model_Project $project)
 {
     $projectMapper = new Project_Model_Mapper_Project();
     if ((int) $project->getId() !== 0) {
         try {
             $projectMapper->update($project);
             return self::PROJECT_UPDATED;
         } catch (Exception $e) {
             return self::PROJECT_UPDATE_FAILED;
         }
     } else {
         try {
             $projectMapper->insert($project);
             return self::PROJECT_CREATED;
         } catch (Exception $e) {
             return self::PROJECT_CREATED_FAILED;
         }
     }
 }
Ejemplo n.º 3
0
 private function _objectToRow(Project_Model_Project $project)
 {
     $projectRow['proj_id'] = $project->getId();
     $projectRow['proj_name'] = $project->getName();
     $projectRow['proj_desc'] = $project->getDescription();
     $projectRow['proj_date'] = $project->getDate();
     $projectRow['proj_statut'] = $project->getStatus();
     $projectRow['proj_hpurl'] = $project->getHomepageUrl();
     $projectRow['proj_docurl'] = $project->getDocUrl();
     $projectRow['usm_id'] = $project->getUser()->getId();
     return $projectRow;
 }