Retrieve specific field from a primary key via get ()

0

I'm having a problem retrieving a specific field from the primary key of my database via get() . I have a primary key with two fields: ('Id', 'IdContract'), however, I have not found a way to define which field of my primary key I want to get:

$aditivo = $this->Aditivos->get($id);

What I would need in this case would be:

 $aditivo = $this->Aditivos->get($idcontrato);
    
asked by anonymous 19.09.2018 / 22:13

1 answer

0

If the primary key is composed, you need to pass both to get the entity via get:

$aditivo = $this->Aditivos->get([$id, $idcontrato]);
    
19.09.2018 / 23:37