コード例 #1
0
 /**
  * update one marriage in the database
  * 
  * @author Jonathan Sandoval <*****@*****.**>
  * @param  Marriage $marriage  The marriage to update
  * @return boolean     if was possible to update
  */
 static function updateMarriage($marriage = null)
 {
     if ($marriage === null) {
         return false;
     }
     $tableMarriage = DatabaseManager::getNameTable('TABLE_MARRIAGE');
     $idBoyfriend = $marriage->getIdBoyfriend();
     $idGirlfriend = $marriage->getIdGirlfriend();
     $id = $marriage->getId();
     $marriageDate = $marriage->getCelebrationDate();
     $idGodFather = $marriage->getIdGodFather();
     $idGodMother = $marriage->getIdGodMother();
     $idChurchMarriage = $marriage->getIdChurchMarriage();
     $idRector = $marriage->getIdRector();
     $idWitness1 = $marriage->getIdWitness1();
     $idWitness2 = $marriage->getIdWitness2();
     $idChurchProcess = $marriage->getIdChurchProcess();
     $idMarriageRegistry = $marriage->getIdBookRegistry();
     $query = "UPDATE {$tableMarriage}\r\n                          SET idBoyfriend        = '{$idBoyfriend}', \r\n                              idGirlfriend       = '{$idGirlfriend}', \r\n                              idGodFather        = '{$idGodFather}', \r\n                              idGodMother        = '{$idGodMother}', \r\n                              idWitness1         = '{$idWitness1}', \r\n                              idWitness2         = '{$idWitness2}',\r\n                              idMarriageRegistry = '{$idMarriageRegistry}', \r\n                              idChurchProcess    = '{$idChurchProcess}', \r\n                              idRector           = '{$idRector}', \r\n                              idChurchMarriage   = '{$idChurchMarriage}', \r\n                              marriageDate       = '{$marriageDate}'\r\n                          WHERE {$tableMarriage}.id = {$id}";
     $personA = PersonManager::getSinglePerson("id", $idBoyfriend);
     $personB = PersonManager::getSinglePerson("id", $idGirlfriend);
     ChangesLogsManager::addChangesLogs("C", "Matrimonio de" . $personA->getFullNameBeginName() . " y " . $personB->getFullNameBeginName());
     return DatabaseManager::singleAffectedRow($query);
 }