Hello kind helper folk,
I'm working with Simple Craft XML Import, which has a handful of older code in it. I've managed to get through most of it to the very end.
The last thing it does is saves tags. My tags are saved, but now it has to relate it back to the entry and Craft appears to be saving them but not relating them back correctly, and not throwing an error.
The saveRelations function appears to need:
an instance of Craft\FieldModel provided in arg 1
an instance of Craft\BaseElementModel provided in arg 2
.. the data in arg 3.
I have the following code:
$tagFieldRecord = FieldRecord::model()->findByPk($tagFieldId); $tagFieldModel = FieldModel::populateModel($tagFieldRecord); $entryRecord = EntryRecord::model()->findById($entryRecord['elementId']); $entryModel = EntryModel::populateModel($entryRecord); craft()->relations->saveRelations($tagFieldModel, $entryModel, $tags);
Everything appears to have saved in the db tables - tags and the relations, but when I go to the entries in the back end, there are no tags.
Is there a good db value to look in on and change to get these to work?
Also, is there something in my code I can change to make this happen through the code and not hacking the db?