if ($_POST["idGirlfriend"] !== '0') { $girlfriend = PersonManager::getSinglePerson('id', $_POST["idGirlfriend"]); } $boyfriend->setId($_POST["idBoyfriend"]); $boyfriend->setNames($_POST["boyfriendName"]); $boyfriend->setLastname1($_POST["lastname1Boyfriend"]); $boyfriend->setLastname2($_POST["lastname2Boyfriend"]); $girlfriend->setId($_POST["idGirlfriend"]); $girlfriend->setNames($_POST["girlfriendName"]); $girlfriend->setLastname1($_POST["lastname1Girlfriend"]); $girlfriend->setLastname2($_POST["lastname2Girlfriend"]); $marriage = new Marriage(); $marriage->setId($_POST["idMarriage"]); $celb = DatabaseManager::singleDateToDatabaseDate($_POST["celebrationDate"]); $marriage->setCelebrationDate($celb); $marriage->setIdChurchProcess($churchProcess->getId()); $marriage->setIdChurchMarriage($churchMarriage->getId()); $marriage->setIdRector($_POST["rectorId"]); if ($boyfriend->getId() === '0') { PersonManager::addPerson($boyfriend, 'true'); $boyfriend = PersonManager::getSinglePerson('id', PersonManager::getLastID()); } else { PersonManager::updatePerson($boyfriend); } if ($girlfriend->getId() === '0') { PersonManager::addPerson($girlfriend, 'true'); $girlfriend = PersonManager::getSinglePerson('id', PersonManager::getLastID()); } else { PersonManager::updatePerson($girlfriend); } $marriage->setIdBoyfriend($boyfriend->getId());