public function index() { try { $this->listarMenus(); $perfis = $this->fachada->listarPerfisAtivos(); $clientes = $this->fachada->listarTodosClientes(); $categoriasOS = $this->fachada->listarCategoriasOSAtivas(); $produtos = $this->fachada->listarProdutos(); $ourives = $this->fachada->listarOurives(); Facil::setar("clientes", $clientes); Facil::setar("categorias", $categoriasOS); Facil::setar("produtos", $produtos); Facil::setar("ourives", $ourives); Facil::setar("perfisUsuario", $perfis->toArray()); $this->templatePlugin->carregarLayoutCompleto(self::DIRETORIO_VISAO); } catch (ControleException $ex) { Facil::despacharErro(404, "Página não encontrada"); } }
public function listar() { try { $produtos = $this->fachada->listarProdutos(); foreach ($produtos->toArray() as $produto) { $this->dataTables->addRow(array($produto->id, $produto->nome, $produto->valor)); } echo $this->dataTables; } catch (Exception $e) { echo new JSONResponse(false, $e->getMessage()); } }