Exemple #1
0
 /**
  * 
  * @param WOOOF $wo
  * @param VO_TblMovieRamaUserMovies $obj
  * @param string $creatorId
  * @return false | id
  * 
  */
 public static function save(WOOOF $wo, VO_TblMovieRamaUserMovies &$obj, $creatorId)
 {
     $place = __CLASS__ . '::' . __FUNCTION__;
     $wo->debug("{$place}:  ");
     if (!$wo->hasContent($creatorId)) {
         $wo->logError(self::_ECP . "0654 No value provided for [creatorId]");
         return false;
     }
     $tblMovieRamaUserMovies = new WOOOF_dataBaseTable($wo->db, 'movierama_user_movies');
     if (!$tblMovieRamaUserMovies->constructedOk) {
         return false;
     }
     if (!$wo->hasContent($obj->id)) {
         //insert
         $obj->publishDateTime = $wo->currentGMTDateTime();
         // insert new movie in table
         $newId = $tblMovieRamaUserMovies->insertRowFromArraySimple($obj->toArray());
         if ($newId === FALSE) {
             return false;
         }
         $obj->id = $newId;
     } else {
         //update
         $updatedId = $tblMovieRamaUserMovies->updateRowFromArraySimple($obj->toArray());
         if ($updatedId === FALSE) {
             return false;
         }
         $obj->id = $updatedId;
     }
     return $obj->id;
 }
Exemple #2
0
 /**
  * 
  * @param WOOOF $wo
  * @param VO_TblPersonProfile $obj
  * @return false | id
  */
 public static function savePersonProfile(WOOOF $wo, VO_TblPersonProfile &$obj)
 {
     $place = __CLASS__ . '::' . __FUNCTION__;
     $wo->debug("{$place}:  ");
     $t1 = new WOOOF_dataBaseTable($wo->db, 'person_profiles');
     if (!$t1->constructedOk) {
         return false;
     }
     if ($wo->hasContent($obj->id)) {
         // update
         $obj->updatedDateTime = WOOOF::currentGMTDateTime();
         $res = $t1->updateRowFromArraySimple($obj->toArray());
         if ($res === FALSE) {
             return false;
         }
     } else {
         // insert
         $obj->isDeleted = '0';
         $obj->createdDateTime = WOOOF::currentGMTDateTime();
         $obj->updatedDateTime = $obj->createdDateTime;
         $newId = $t1->insertRowFromArraySimple($obj->toArray());
         if ($newId === FALSE) {
             return false;
         }
         $obj->id = $newId;
     }
     return $obj->id;
 }
 /**
  *
  * @param WOOOF $wo
  * @param VO_TblFlagItems $obj
  * @param char $action
  * @param bool $fetchBack
  * @return false | type of reported object
  * Returns actually saved $obj if $fetchBack is set to true
  */
 public static function save(WOOOF $wo, VO_TblFlagItems &$obj, $action = 'I', $fetchBack = true)
 {
     $place = __CLASS__ . '::' . __FUNCTION__;
     $wo->debug("{$place}:  ");
     if (!$wo->hasContent($obj->flaggedByUserId)) {
         $wo->logError(self::_ECP . "3011 No value provided for [flaggedByUserId]");
         return false;
     }
     if (!$wo->hasContent($obj->whatId)) {
         $wo->logError(self::_ECP . "3012 No value provided for [whatId]");
         return false;
     }
     if (!$wo->hasContent($obj->whatType)) {
         $wo->logError(self::_ECP . "3013 No value provided for [whatType]");
         return false;
     }
     if ($obj->flaggedByUserId === $obj->whatId) {
         $wo->logError(self::_ECP . "3014 Id's cannot be the same");
         return false;
     }
     $tblFlagItems = new WOOOF_dataBaseTable($wo->db, 'flag_items');
     if ($tblFlagItems === FALSE) {
         return false;
     }
     //insert
     if ($action === 'I') {
         $obj->flaggedDateTime = WOOOF::currentGMTDateTime();
         $newId = $tblFlagItems->insertRowFromArraySimple($obj->toArray());
         if ($newId === FALSE) {
             return false;
         }
     } else {
         $obj->flaggedDateTime = $wo->currentGMTDateTime();
         $res = $tblFlagItems->updateRowFromArraySimple($obj->toArray());
         if ($res === FALSE) {
             return false;
         }
     }
     return $obj->whatType;
 }
 /**
  *
  * @param WOOOF $wo
  * @param VO_TblEvaluationResults $obj
  * @return false | id
  *
  */
 public static function saveResults(WOOOF $wo, VO_TblEvaluationResults &$obj)
 {
     $place = __CLASS__ . '::' . __FUNCTION__;
     $wo->debug("{$place}:  ");
     $tblEvaluationResults = new WOOOF_dataBaseTable($wo->db, 'evaluation_results');
     if (!$tblEvaluationResults->constructedOk) {
         return false;
     }
     if (!$wo->hasContent($obj->id)) {
         //insert
         $newId = $tblEvaluationResults->insertRowFromArraySimple($obj->toArray());
         if ($newId === FALSE) {
             return false;
         }
     } else {
         //update
         $updatedId = $tblEvaluationResults->updateRowFromArraySimple($obj->toArray());
         if ($updatedId === FALSE) {
             return false;
         }
     }
     return $obj->evaluationId;
 }