AR
Erro ao deletar registros usando View
Olá, depois que passei a usar uma view no formulário, não estou conseguindo deletar registros pela grid. Podem me ajudar ?
Erro:
SQLSTATE[55000]: Object not in prerequisite state: 7 ERROR: cannot delete from view "view_lancamentos" DETAIL: Views that do not select from a single table or view are not automatically updatable. HINT: To enable deleting from the view, provide an INSTEAD OF DELETE trigger or an unconditional ON DELETE DO INSTEAD rule.
- <?php
- /**
- * LancamentoDataGridView Listing
- */
- class LancamentoDataGridView extends TPage
- {
- protected $form; // registration form
- protected $datagrid; // listing
- protected $pageNavigation;
- protected $formgrid;
- protected $formtotais;
- protected $deleteButton;
- use Adianti\base\AdiantiStandardListTrait;
- /**
- * Page constructor
- */
- public function __construct()
- {
- parent::__construct();
- $this->setDatabase('newcoco'); // defines the database
- $this->setActiveRecord('ViewLancamentos'); // defines the active record
- $this->setDefaultOrder('id', 'asc'); // defines the default order
- ?>
Erro:
SQLSTATE[55000]: Object not in prerequisite state: 7 ERROR: cannot delete from view "view_lancamentos" DETAIL: Views that do not select from a single table or view are not automatically updatable. HINT: To enable deleting from the view, provide an INSTEAD OF DELETE trigger or an unconditional ON DELETE DO INSTEAD rule.
A view não deleta no Banco
Para excluir tem que usar a tabela, ai você vai ter que tratar isso no onDelete
Será que posso instanciar a tabela (Lancamento($param->id) ) usando o parâmetro ID ?