Error when deleting a row if the table has a join with a View

Error when deleting a row if the table has a join with a View

duagogduagog Posts: 5Questions: 3Answers: 0

hi guys,
I'm getting the following error when deleting a row:
SQLSTATE[HY000]: General error: 1288 The target table sumaLineasPedido of the DELETE is not updatable

The code for the editor is below and as you can see the problem comes with the join.
I've read a similar question and it was solved replacing the code for the function remove table in the file editor.php. In the answer it was written that the solution would be included in a next release.

What can I do to solve this issue?

Editor::inst( $db, 'marcas' )
->fields(
// Field::inst( 'codigoMarca' )->validator( 'Validate::unique' ),
Field::inst( 'marcas.marca' )->validator( 'Validate::notEmpty' ),
Field::inst( 'marcas.metros' ),
Field::inst( 'sumaLineasPedido.metrosConsumidos' )
// Field::inst( 'activa' )->validator( 'Validate::notEmpty' )
)
->leftJoin( 'sumaLineasPedido', 'marcas.id', '=', 'sumaLineasPedido.idMarca' )
->process( $_POST )
->json();

Thanks for your support.
Dani

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,813Questions: 1Answers: 10,516 Site admin
    Answer ✓

    Could you try:

    Field::inst( 'sumaLineasPedido.metrosConsumidos' )->set( false )
    

    I'm assuming that you don't want to update the joined table's value?

    Thanks,
    Allan

  • duagogduagog Posts: 5Questions: 3Answers: 0

    Hi Allan,
    many thanks for the quick response.
    It's working fine now!

    Dani

This discussion has been closed.