Update a model’s attribute by another cakephp’s controller

Asked

Viewed 25 times

0

[SOLVED] I have a business logic as follows, when the user changes an attribute to paid (change from 0 to 1) I need him to update the balance value of another model.

inserir a descrição da imagem aqui

when the user changes the status of the paid installment that belongs to the installments table I want to change the value of the balance that is within the contract table

schema: contract 1 - n installments

1 answer

0


I got it with that code:

        $this->Iten->Contrato->id=$id;
        $this->Iten->Contrato->saveField("valorTotal",$novoValor);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.