Answer the question
In order to leave comments, you need to log in
How to work with two tables?
My goal is to first check if there is a value in one table, then write the data to another table, I do this:
$this->Cabinet->useTable = 'accounts';
$subjectInfo = $this->Cabinet->find('all',[
'conditions' => [
'temp_login' => $subject
]
]);
if(!$subjectInfo)
return 0;
$this->Cabinet->useTable = 'messages';
$this->Cabinet->create();
$this->Cabinet->set([
'userIdFrom' => 0,
'loginFrom' => $tempLogin,
'loginTo' => $subject,
'message' => $message,
'deleteAfterRead' => $deleteAfterRead
]);
$this->Cabinet->save();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question