I am having trouble saving a ChannelEntry with a relationship to another ChannelEntry using the Models Service.
The following produces no errors, but a row in exp_relationships with no field_id
$entry = ee('Model')->get('ChannelEntry') ->with('Children', 'Channel') ->filter('entry_id', 330)->first(); $child = ee('Model')->get('ChannelEntry')->filter('channel_id', 7)->filter('title', 'My title')->first(); $entry->Children = $child; $entry->save();
In the Control Panel, this shows no relationships have been set. I can manually add the field_id to the DB, and poof the relationship is created.
So how do I create the relationship with the field_id column populated?
Also, I noticed it also creates a row in the exp_channel_data_field_23 (the id of my relationship field) with a NULL value in the field_id_23 column. Adding a relationship through the Control Panel does not produce a row in this table at all, however...