本文整理汇总了PHP中TRepository::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP TRepository::delete方法的具体用法?PHP TRepository::delete怎么用?PHP TRepository::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRepository
的用法示例。
在下文中一共展示了TRepository::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeListOfMaterialPermanente
public function removeListOfMaterialPermanente()
{
$criteria = new TCriteria();
$criteria->add(new TFilter('tipo_material_permanente_id', '=', $this->id));
$repository = new TRepository('MaterialPermanente');
return $repository->delete($criteria);
}
示例2: delete
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);
}
示例3: delete
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);
}
示例4: delete
/**
* 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);
}
示例5: delete
/**
* 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);
}
示例6: delete
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);
}
示例7: __construct
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());
}
}
示例8: __construct
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());
}
}
示例9: delete
/**
* 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);
}
示例10: onSave
/**
* 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
}
}
示例11: delete
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);
}
示例12: delete
/**
* 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);
}
示例13: deleteComposite
/**
* 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);
}
示例14: __construct
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());
}
//-----------------------------------------------------------------------
}
示例15: TFilter
$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();
}