I am trying to store an entry in a plugin. The entry has a field 'tags' that relates to another entry. I am trying to store it with the following code.
$newsItem = new EntryModel();
$newsItem->sectionId = craft()->sections->getSectionByHandle('news')->id;
$newsItem->getContent()->tags = $tag->id;
craft()->entries->saveEntry($newsItem);
When I var_dump(craft()->entries->saveEntry($newsItem))
I get a false
response.
Also, in this situation we cannot use the method setContentFromPost()
so we need to do it from within the plugin and not from a front-end form.