Пример #1
0
 /**
  * @return array
  * @param string $numero_processo
  */
 public function recoverInformationDBByProcess($numero_processo)
 {
     $vinculacao = new Vinculacao();
     $stmt = Controlador::getInstance()->getConnection()->connection->prepare("\r\n            SELECT DC.DIGITAL\r\n            FROM TB_PROCESSOS_DOCUMENTOS PXD\r\n                INNER JOIN TB_PROCESSOS_CADASTRO PC ON PC.ID = PXD.ID_PROCESSOS_CADASTRO\r\n                INNER JOIN TB_DOCUMENTOS_CADASTRO DC ON DC.ID = PXD.ID_DOCUMENTOS_CADASTRO\r\n            WHERE PC.NUMERO_PROCESSO = ? ORDER BY PXD.ID\r\n        ");
     $stmt->bindParam(1, $numero_processo, PDO::PARAM_STR);
     $stmt->execute();
     $first = $stmt->fetchAll(PDO::FETCH_ASSOC);
     $list = $all = array();
     foreach ($first as $key => $digital) {
         $all[$digital['DIGITAL']] = $vinculacao->getDocumentosRelacionados($digital['DIGITAL']);
     }
     foreach ($all as $pai => $filhos) {
         $list[] = $pai;
         foreach ($filhos as $key => $xn) {
             if (in_array($key, $list) === false) {
                 $list[] = $key;
             }
             foreach ($xn as $ix => $jk) {
                 if (in_array($jk, $list) === false) {
                     $list[] = $jk;
                 }
             }
         }
     }
     $response = array();
     foreach ($list as $key => $digital) {
         $response = array_merge($response, $this->recoverInformationDBByDigital($digital));
     }
     return $response;
 }
 /**
  * Carrega Documentos Relacionados
  * @param string $parDigital
  * @throws Exception
  */
 protected function _loadDocumentosRelacionados($parDigital = '')
 {
     if (!$parDigital) {
         throw new \Exception('BlocoDocumental::_loadDocumentosRelacionados() - Número da Digital não informado para carregamento dos Documentos Relacionados');
     }
     $vinculacao = new \Vinculacao();
     $documentosRelacionados = $vinculacao->getDocumentosRelacionados($parDigital);
     $this->_arrDigitaisRelacionadas = array();
     if (is_array($documentosRelacionados) && count($documentosRelacionados)) {
         $arrDocumentosRelacionados = $documentosRelacionados[$parDigital];
         foreach ($arrDocumentosRelacionados as $chave => $valor) {
             if ($chave !== 'this') {
                 $this->_arrDigitaisRelacionadas[] = $valor;
             }
         }
     }
 }