/** * @param \Sudoux\MortgageBundle\Entity\LoanApplication $application * @param \Sudoux\MortgageBundle\Entity\Borrower $borrower * @param $destinyBorrower * @param bool $isCoBorrower * @author Eric Haynes */ protected function convertDestinyToBorrower(LoanApplication $application, Borrower $borrower, $destinyBorrower, $isCoBorrower = false) { $borrowerSsn = $destinyBorrower['@attributes']['ssn']; $borrower->setSsn($borrowerSsn); $borrowerFirstName = ucwords(strtolower($destinyBorrower['@attributes']['first-name'])); $borrower->setFirstName($borrowerFirstName); $borrowerLastName = ucwords(strtolower($destinyBorrower['@attributes']['last-name'])); $borrower->setLastName($borrowerLastName); $borrowerMiddleInitial = ucwords(strtolower($destinyBorrower['@attributes']['middle-name'])); if (strlen($borrowerMiddleInitial) > 0) { $borrower->setMiddleInitial($borrowerMiddleInitial[0]); } else { $borrower->setMiddleInitial(''); } $borrowerSuffix = ucwords(strtolower($destinyBorrower['@attributes']['generation'])); $borrower->setSuffix($borrowerSuffix); $borrowerEmail = $destinyBorrower['@attributes']['email']; $borrower->setEmail($borrowerEmail); if (isset($destinyBorrower['@attributes']['home-phone'])) { $borrower->setPhoneHome($destinyBorrower['@attributes']['home-phone']); } if (isset($destinyBorrower['@attributes']['work-phone'])) { $borrower->setPhoneHome($destinyBorrower['@attributes']['work-phone']); } $borrowerBirthDate = $destinyBorrower['@attributes']['birthdate']; $borrower->setBirthDate($this->convertToDateTime($borrowerBirthDate)); // BorrowerLocation Location $borrowerLocation = $borrower->getLocation(); $borrowerLocationLocation = $borrowerLocation->getLocation(); $borrowerLocationLocationAddress = ucwords(strtolower($destinyBorrower['@attributes']['street-address'])); $borrowerLocationLocation->setAddress1($borrowerLocationLocationAddress); $borrowerLocationLocationCity = ucwords(strtolower($destinyBorrower['@attributes']['city'])); $borrowerLocationLocation->setCity($borrowerLocationLocationCity); $borrowerLocationLocationState = $destinyBorrower['@attributes']['state']; $borrowerLocationLocationStateEntity = $this->em->getRepository('SudouxCmsLocationBundle:State')->findStateByAbbreviation($borrowerLocationLocationState); $borrowerLocationLocation->setState($borrowerLocationLocationStateEntity); $borrowerLocationLocationZipcode = $destinyBorrower['@attributes']['zip']; $borrowerLocationLocation->setZipcode($this->toZipcode($borrowerLocationLocationZipcode)); if ($isCoBorrower) { $borrower->setPrimaryBorrower(false); } else { $borrower->setPrimaryBorrower(true); } }