public function afterLoad($model)
{
// we need to collect ID
$this->id = $model->data[$this->master_field];
if (!$this->id) {
return;
}
try {
$data = $model->persistence->load($model, $this->id, $this->foreign_table);
} catch (Exception $e) {
throw new Exception(['Unable to load joined record', 'table' => $this->foreign_table, 'id' => $this->id], $e->getCode(), $e);
}
$model->data = array_merge($data, $model->data);
}