/** * Update one church in the database * * @author Jonathan Sandoval <*****@*****.**> * @param Church $church The church to update * @return boolean If was possible to update */ static function updateChurch($church = null) { if ($church === null) { return false; } $tableChurch = DatabaseManager::getNameTable('TABLE_CHURCH'); $id = $church->getId(); $name = $church->getName(); $type = $church->getType(); $code = $church->getCode(); $address = $church->getAddress(); $colony = $church->getColony(); $postalCode = $church->getPostalCode(); $phoneNumber = $church->getPhoneNumber(); $idVicar = $church->getIdVicar(); $idDean = $church->getIdDean(); $idCity = $church->getIdCity(); $idNiche = $church->getIdNiche(); $query = "UPDATE {$tableChurch}\r\n SET name = '{$name}', \r\n type = '{$type}', \r\n code = '{$code}', \r\n address = '{$address}', \r\n colony = '{$colony}', \r\n postalCode = '{$postalCode}', \r\n phoneNumber = '{$phoneNumber}', \r\n idVicar = '{$idVicar}', \r\n idDean = '{$idDean}', \r\n idCity = '{$idCity}', \r\n idNiche = {$idNiche} \r\n WHERE {$tableChurch}.id = {$id}"; ChangesLogsManager::addChangesLogs("C", "Iglesia de " . $church->getName()); return DatabaseManager::singleAffectedRow($query); }