Exemplo n.º 1
0
function libCorpDeleteTelefone($delTelefone, $userCredential = NULL)
{
    $xmlResult = '<result><status>%s</status><errocode>%s</errocode><response>%s</response></result>';
    try {
        Registry::factory()->setCredential($userCredential);
        $voTelefone = TelefoneValueObject::factory()->loadData($delTelefone);
        $voTelefone = TelefoneBusiness::factory()->deleteTelefone($voTelefone);
        return sprintf($xmlResult, 'success', '00000', 'Registro Excluido com Sucesso');
    } catch (\Exception $excp) {
        return sprintf($xmlResult, 'failure', $excp->getCode(), $excp->getMessage());
    }
}
Exemplo n.º 2
0
 /**
  * Atualiza os dados de Telefone
  *
  * @example TelefoneBusiness::updateTelefone
  * @code
  * <?php
  *     # cria filtro usado por agencia
  *     $voTelefone       = ValueObjectAbstract::factory('fullnamespace');
  *     # outra forma de utilizar
  *     # $voTelefone = TelefoneValueObject::factory();
  *     $voTelefone->setSqTelefone(1);
  *
  *     # efetua exclusao
  *     $telefoneBusiness = TelefoneBusiness::factory();
  *     $telefoneBusiness->updateTelefone($voTelefone);
  * ?>
  * @endcode
  *
  * @param TelefoneValueObject $voTelefone
  * @return TelefoneValueObject
  * @throws BusinessException
  */
 public function updateTelefone(TelefoneValueObject $voTelefone)
 {
     try {
         $voTmp = TelefoneBusiness::factory(NULL, 'libcorp')->find($voTelefone->getSqTelefone());
         BusinessException::throwsExceptionIfParamIsNull($voTmp->getSqTelefone(), self::IDENTIFIER_NOT_FOUND);
         $voTelefone->copySaveObjectData($voTmp);
         $this->getModelPersist('libcorp')->update($voTelefone);
         return $voTelefone;
     } catch (ModelException $mExcp) {
         throw new BusinessException($mExcp->getMessage());
     }
 }