public function removeListOfMaterialPermanente() { $criteria = new TCriteria(); $criteria->add(new TFilter('tipo_material_permanente_id', '=', $this->id)); $repository = new TRepository('MaterialPermanente'); return $repository->delete($criteria); }
public function delete($id = NULL) { $id = isset($id) ? $id : $this->{'id'}; $criteria = new TCriteria(); $criteria->add(new TFilter('project_id', '=', $id)); $repository = new TRepository('Backlog'); $repository->delete($criteria); parent::delete($id); }
public function delete($id = NULL) { $id = isset($id) ? $id : $this->logra_id; $repository = new TRepository('LogradouroBairro'); $criteria = new TCriteria(); $criteria->add(new TFilter('tb_logradouros_logra_id', '=', $id)); $repository->delete($criteria); // delete the object itself parent::delete($id); }
/** * Delete an Active Record object from the database * @param [$id] The Object ID * @exception Exception if there's no active transaction opened */ public function delete($id = NULL) { $id = isset($id) ? $id : $this->{'id'}; $note_rep = new TRepository('Note'); $criteria = new TCriteria(); $criteria->add(new TFilter('id_issue', '=', $id)); $note_rep->delete($criteria); // delete the object itself parent::delete($id); }
/** * Delete the object and its aggregates * @param $id object ID */ public function delete($id = NULL) { // delete the related System_userSystem_user_group objects $id = isset($id) ? $id : $this->id; $repository = new TRepository('SystemStock'); $criteria = new TCriteria(); $criteria->add(new TFilter('id', '=', $id)); $repository->delete($criteria); // delete the object itself parent::delete($id); }
/** * Delete the object and its aggregates * @param $id object ID */ public function delete($id = NULL) { // delete the related System_groupSystem_program objects $id = isset($id) ? $id : $this->id; $repository = new TRepository('SystemGroupProgram'); $criteria = new TCriteria(); $criteria->add(new TFilter('system_group_id', '=', $id)); $repository->delete($criteria); // delete the object itself parent::delete($id); }
public function delete($id = NULL) { //sobrescrito! $id = isset($id) ? $id : $this->id; $repository = new TRepository('TurmaDisciplina'); $criteria = new TCriteria(); $criteria->add(new TFilter('turma_id', '=', $id)); $repository->delete($criteria); $repository = new TRepository('AlunoTurma'); $repository->delete($criteria); parent::delete($id); }
public function __construct() { parent::__construct(); try { TTransaction::open('samples'); $criteria = new TCriteria(); $criteria->add(new TFilter('address', 'like', 'Rua Porto%')); $criteria->add(new TFilter('gender', '=', 'M')); $repository = new TRepository('Customer'); $repository->delete($criteria); new TMessage('info', 'Records Deleted'); TTransaction::close(); } catch (Exception $e) { new TMessage('error', $e->getMessage()); } }
public function __construct() { parent::__construct(); try { TTransaction::open('samples'); // abre uma transação TTransaction::setLogger(new TLoggerTXT('/tmp/log3.txt')); $criteria = new TCriteria(); $criteria->add(new TFilter('address', 'like', 'Rua Porto%')); $criteria->add(new TFilter('gender', '=', 'M')); $repository = new TRepository('Customer'); $repository->delete($criteria); new TMessage('info', 'Registros excluídos'); TTransaction::close(); // fecha a transação. } catch (Exception $e) { new TMessage('error', $e->getMessage()); } }
/** * Delete the object and its aggregates * @param $id object ID */ public function delete($id = NULL) { $id = isset($id) ? $id : $this->id; // delete the related Item objects $repository = new TRepository('Item'); $criteria = new TCriteria(); $criteria->add(new TFilter('srp_id', '=', $id)); $repository->delete($criteria); // delete the object itself parent::delete($id); }
/** * Delete the book and its aggregates */ public function delete($id = NULL) { $id = isset($id) ? $id : $this->{'id'}; $criteria = new TCriteria(); $criteria->add(new TFilter('book_id', '=', $id)); $repository = new TRepository('BookAuthor'); $repository->delete($criteria); $repository = new TRepository('BookSubject'); $repository->delete($criteria); $repository = new TRepository('Item'); $repository->delete($criteria); // delete the object itself parent::delete($id); }
/** * method onSave() * Executed whenever the user clicks at the save button */ function onSave() { try { TTransaction::open('atividade'); // open a transaction with database // get the form data into an active record CargaHoraria $object = $this->form->getData('CargaHoraria'); $object->horario = $object->qtde_horas . ':' . str_pad($object->qtde_minutos, 2, 0, STR_PAD_LEFT); $criteria = new TCriteria(); $criteria->add(new TFilter("mes", "=", $object->mes)); $criteria->add(new TFilter("ano", "=", $object->ano)); $repo = new TRepository('CargaHoraria'); $horarios = $repo->delete($criteria); $criteria = new TCriteria(); $criteria->add(new TFilter("origem", "=", 1)); $criteria->add(new TFilter("codigo_cadastro_origem", "=", 100)); $criteria->add(new TFilter("ativo", "=", 1)); $criteria->add(new TFilter("usuario", "is not ")); $repo = new TRepository('Pessoa'); $pessoas = $repo->load($criteria); foreach ($pessoas as $pessoa) { $cargaHoraria = new CargaHoraria(); $cargaHoraria->mes = $object->mes; $cargaHoraria->ano = $object->ano; $cargaHoraria->horario = $object->horario; $cargaHoraria->colaborador_id = $pessoa->pessoa_codigo; $cargaHoraria->store(); // stores the object } new TMessage('info', 'Registros salvos'); // success message $this->form->setData($object); // fill the form with the active record data TTransaction::close(); // close the transaction $param['mes'] = $object->mes; $param['ano'] = $object->ano; $this->onReload($param); // reload the listing } catch (Exception $e) { new TMessage('error', '<b>Error</b> ' . $e->getMessage()); // shows the exception error message TTransaction::rollback(); // undo all pending operations } }
/** * Delete the object and its aggregates * @param $id object ID */ public function delete($id = NULL) { // delete the related CustomerSkill objects $id = isset($id) ? $id : $this->id; $repository = new TRepository('CustomerSkill'); $criteria = new TCriteria(); $criteria->add(new TFilter('customer_id', '=', $id)); $repository->delete($criteria); // delete the object itself parent::delete($id); }
public function delete($id = NULL) { $id = isset($id) ? $id : $this->imovel_id; $repository = new TRepository('ImovelProprietarios'); $criteria = new TCriteria(); $criteria->add(new TFilter('tb_imovel_imovel_id', '=', $id)); $repository->delete($criteria); // delete the object itself parent::delete($id); }
/** * Delete an Active Record object from the database * @param [$id] The Object ID * @exception Exception if there's no active transaction opened */ public function delete($id = NULL) { $id = isset($id) ? $id : $this->{'id'}; $member_project_rep = new TRepository('MemberProject'); $criteria = new TCriteria(); $criteria->add(new TFilter('id_member', '=', $id)); $member_project_rep->delete($criteria); // delete the object itself parent::delete($id); }
/** * Delete composite objects (parts in composition relationship) * @param $composite_class Active Record Class for composite objects * @param $foreign_key Foreign key in composite objects * @param $id Primary key of parent object */ public function deleteComposite($composite_class, $foreign_key, $id) { $criteria = new TCriteria(); $criteria->add(new TFilter($foreign_key, '=', $id)); $repository = new TRepository($composite_class); return $repository->delete($criteria); }
public function __construct() { parent::__construct(); //---------------------Insere Ticket id+200--------------------------------- try { TTransaction::open('atividade'); $criteria = new TCriteria(); $repository = new TRepository('Ticket'); $criteria->add(new TFilter('id', '>', 100)); $criteria->add(new TFilter('id', 'NOT IN', array(135, 136, 137))); $tickets = $repository->load($criteria); foreach ($tickets as $ticket) { echo $ticket->id . " <br> "; $ticket->id = $ticket->id + 200; $ticket->store(); } TTransaction::close(); } catch (Exception $e) { new TMessage('error', $e->getMessage()); } //-------------------atividade--------------------------------- try { TTransaction::open('atividade'); $criteria = new TCriteria(); $repository = new TRepository('Atividade'); $criteria->add(new TFilter('ticket_id', '>', 100)); $criteria->add(new TFilter('ticket_id', 'NOT IN', array(135, 136, 137))); $atividades = $repository->load($criteria); foreach ($atividades as $atividade) { $atividade->ticket_id = $atividade->ticket_id + 200; $atividade->store(); } TTransaction::close(); } catch (Exception $e) { new TMessage('error', $e->getMessage()); } //--------------------RequisitoDesenvolvimento-------------------------- try { TTransaction::open('atividade'); $criteria = new TCriteria(); $repository = new TRepository('RequisitoDesenvolvimento'); $criteria->add(new TFilter('ticket_id', '>', 100)); $criteria->add(new TFilter('ticket_id', 'NOT IN', array(135, 136, 137))); $requisitos = $repository->load($criteria); foreach ($requisitos as $requisito) { $requisito->ticket_id = $requisito->ticket_id + 200; $requisito->store(); } TTransaction::close(); } catch (Exception $e) { new TMessage('error', $e->getMessage()); } // -------------Deleta tickets maior que 100 e menor que 200-------------- try { TTransaction::open('atividade'); $criteria = new TCriteria(); $criteria->add(new TFilter('id', '>', 100)); $criteria->add(new TFilter('id', '<', 200)); $criteria->add(new TFilter('id', 'NOT IN', array(135, 136, 137))); $repository = new TRepository('Ticket'); $repository->delete($criteria); new TMessage('info', 'Processamento Efetuado'); TTransaction::close(); } catch (Exception $e) { new TMessage('error', $e->getMessage()); } //----------------------------------------------------------------------- }
$criteria->add(new TFilter('turno', '=', 'T')); // instancia repositório de Turmas $repository = new TRepository('Turma'); // retorna todos objetos que satisfazem o critério $turmas = $repository->load($criteria); // verifica se retornou alguma turma if ($turmas) { // percorre todas turmas retornadas foreach ($turmas as $turma) { // exclui a turma $turma->delete(); } } // segundo exemplo, exclui as inscrições do aluno "1" TTransaction::log("** exclui as inscrições do aluno '1'"); // instancia critério de seleção de dados ref_aluno ='1' $criteria = new TCriteria(); $criteria->add(new TFilter('ref_aluno', '=', 1)); // instancia repositório de Inscrição $repository = new TRepository('Inscricao'); // exclui todos objetos que satisfaçam este critério de seleção $repository->delete($criteria); echo "registros excluídos com sucesso <br>\n"; // finaliza a transação TTransaction::close(); } catch (Exception $e) { // exibe a mensagem gerada pela exceção echo '<b>Erro</b>' . $e->getMessage(); // desfaz todas alterações no banco de dados TTransaction::rollback(); }