-
Notifications
You must be signed in to change notification settings - Fork 48
Reverse join not saving #799
Copy link
Copy link
Closed
Labels
Description
Following situation:
Table 1 (contact_table):
contact_id (primary), tbl1_name, tbl1_address
Table_2 (additional_info_table):
additional_id (primary), additional_contact_id (relation), additional_content
Let's assume I have a contact table which is loaded always (Table 1).
I want to read, if there's an entry available from an additional table (Table 2). Table 2 always references to Table 1.
class myModel extends \atk4\data\Model {
use \atk4\core\TrackableTrait;
use \atk4\core\AppScopeTrait;
public $table = "contact_table";
public $id_field = "contact_id";
function init(): void {
parent::init();
$this->leftJoin($this->'additional_info_table', [
'master_field' => 'contact_id',
'foreign_field' => 'additional_contact_id',
'reverse' => true
]);
}
}
When using this model in a form, it reads properly, but it just saves data from the main table. The data of the joined table is neither inserted nor updated.
Is this how it's intended to work? If yes, then how to deal with a situation like this?
Reactions are currently unavailable