public function deletar(ProdutoOpcaoValor $obj) { $where = "WHERE " . self::ID . " = '" . $obj->getId() . "'"; $lPOV = new ListaProdutoOpcaoValores(); $lPOG = new ListaProdutoOpcaoGerados(); $lPOG->condicoes('', $obj->getId(), ListaProdutoOpcaoGerados::VALOR); if ($lPOG->getTotal() == 0) { Arquivos::__DeleteArquivo(Sistema::$caminhoDiretorio . Sistema::$caminhoDataProdutoOpcoes . $m->getImagem()->nome . '.' . $m->getImagem()->extensao); $this->con->deletar(Sistema::$BDPrefixo . $this->tabela, $where); $this->con->deletar(Sistema::$BDPrefixo . $lPOV->getTabela(), "WHERE " . ListProdutoOpcaoValores::OPCAO . " = '" . $obj->getId() . "'"); } else { throw new Exception('Produtos cadastrados com este valor'); } }