Retrieve specific field of a primary key via get()

Asked

Viewed 33 times

0

I am facing a problem at the time of recovering a specific field of primary key from my database via get(). I have a primary key with two fields: ('Id', 'Idcontrato'), however, I have not found a way to define which field of my Primary key I wish to get:

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

What I would need in case would be:

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

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]);

Browser other questions tagged

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