DELETE when primary key in leftJoin
DELETE when primary key in leftJoin
I have primary key cert_vzo_par.id in leftJoin
$data = Editor::inst($db, 'cert_vzo_par', 'id')
...
->leftJoin( 'cvpriv', 'cvpriv.cvpar_id', '=', 'cert_vzo_par.id' )
When I try to DELETE the row in this case is trying to delete also from the view cvpriv.
DELETE FROM cvpriv WHERE cvpriv.cvpar_id = :where_0
Is there a way to avoid deleting from the view in the leftJoin where it is primary key from the main table?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Do you need to submit the value of the joined table's primary key? What is that being used for?
Allan
The view cvpriv is actually the view created from the table from Mjoin, cert_vzo_pri.
If I replace
to
it works, but I need different columns from different tables to show to the costumer not exactly from the cert_vzo_pri. I just wanted to simplify the whole php because it is already 200 lines.
As far I can see the only solution, I'm using Oracle, is to create INSTEAD OF trigger to be able to DELETE the values from the view cvpriv.
I thought only the Mjoin is responsible to DELETE data from the dependant table.
Here is the whole php.
I have solved this simply by set(false) to all the cvpriv columns.
Now I can use the view instead of the table and DELETE is working as expected.