Hello! Please help me figure it out.
There are 3 tables (jobs, proposals, user).
jobs: -id -description ... proposals: -id -title -job_id -user_id ... user: -id -username ... Now I connect tables of jobs and proposals.
models / Job.php
public function getProposals() { return $this->hasMany(Proposal::className(), ['job_id' => 'id']); } and bring:
$obj = Job::find()->where(['id' => $id])->one(); foreach ($obj->proposals as $proposals){ ... } How can I bind more proposals and user so that in foreach I want to output username from the user table?