I'm using a custom plugin with a service and controller to save relational fields to entries. I'm able to do this just fine, but when it saves an entry, it sets the author as NULL in the database and it no longer shows in the author's list of authored entries.
I've tried to both not set the author at all and to manually set the author to the previous author. Craft gives me an Internal Service Error saying "Property 'Craft\EntryModel.author' is read only." when trying to set the author in the code. Removing the retrieval and setting of the author saves the entry but marks the author as NULL
Has anyone else faced this? Is it a bug?
For reference, here's the heart of this service's code:
$criteria3 = craft()->elements->getCriteria(ElementType::Entry); $criteria3->id = $kitId; $currentKit = $criteria3->first(); $currentAuthor = $currentKit->author; $kit = new EntryModel(); $kit->sectionId = '6'; $kit->id = $kitId; $kit->author = $currentAuthor; $success = craft()->entries->saveEntry($kit);