PersonManager::updatePerson($child); } $baptism->setIdOwner($child->getId()); //Process The GodFather if ($_POST["nameGodFather"] !== '') { $godFather = PersonManager::getSinglePerson('names', $_POST["nameGodFather"], 'lastname1', $_POST["lastname1GodFather"], 'lastname2', $_POST["lastname2GodFather"]); if ($godFather === NULL) { $godFather = new Person(); $godFather->setNames($_POST["nameGodFather"]); $godFather->setLastname1($_POST["lastname1GodFather"]); $godFather->setLastname2($_POST["lastname2GodFather"]); $godFather->setGender('M'); PersonManager::addPerson($godFather, 'true'); $godFather = PersonManager::getSinglePerson('id', PersonManager::getLastID()); } $baptism->setIdGodFather($godFather->getId()); } //Process The GodFather if ($_POST["nameGodMother"] !== '') { $godMother = PersonManager::getSinglePerson('names', $_POST["nameGodMother"], 'lastname1', $_POST["lastname1GodMother"], 'lastname2', $_POST["lastname2GodMother"]); if ($godMother === NULL) { $godMother = new Person(); $godMother->setNames($_POST["nameGodMother"]); $godMother->setLastname1($_POST["lastname1GodMother"]); $godMother->setLastname2($_POST["lastname2GodMother"]); $godMother->setGender('F'); PersonManager::addPerson($godMother, 'true'); $godMother = PersonManager::getSinglePerson('id', PersonManager::getLastID()); } $baptism->setIdGodMother($godMother->getId()); }