Ejemplo n.º 1
0
 public function deletar(ProdutoOpcao $obj)
 {
     $where = "WHERE " . self::ID . " = '" . $obj->getId() . "'";
     $lPOG = new ListaProdutoOpcaoGerados();
     $lPOG->condicoes('', $obj->getId(), ListaProdutoOpcaoGerados::OPCAO);
     if ($lPOG->getTotal() == 0) {
         $this->con->deletar(Sistema::$BDPrefixo . $this->tabela, $where);
     } else {
         throw new Exception('Produtos cadastrados com esta opção');
     }
 }
 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');
     }
 }