This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hello,
I'm struggling a bit with the relationship models. I have two tables (t1: id, flag1, flag2, ... & t2: id, some_text) that I would like to releate and insert to from one back-end form. In the model of t1 I've set up the relation with hasOne as described in the documentation:
public $hasOne = ['some_text' => ['Me\Testplugin\Models\Post_content', 'key' => 'id', 'otherKey' => 'id']];
However no matter what I try I either do not get any data into t2 at all, or it tries to insert the column 'some_text' into t1 where it doesn't exist. I've searched the forum for similar question and I also tried adding a related column to t1 and using proxy fields - neither which has worked for me.
What is the proper way to do this? Thanks!
Guywood said: What is the proper way to do this?
There are 3 examples of hasOne relation backendcontroller (People/Phones) in Test Playground plugin, please take a look: https://github.com/daftspunk/oc-test-plugin
1-2 of 2