Hey all !
In my model i have a Post entity and a Tag entity; and posts have tags. Simple !
In my form, when the user creates a tag that is not existing in the DB, I do:
- keep the returned ItemReference in memory;
- add the tag object to the tags list of my post.
Then when i want to save the post, I want to use my saved ItemReference to be sure of what will be committed. But when i do that i get the exception that says items are not managed by the dataStore:
Commit called with an item at array location: 0 which is not a managed item in this dataStore
I am a bit confused, because the help explicitly says that we can call commit with ItemReferences coming from serviceControl.getItem() or serviceControl.createItem().
// Create a tag
var tag:Tag = new Tag(); tag.name = name var it:ItemReference = tagService.createTag(tag); pendingNewTags[name] = it; post.tags.addItem(tag);
// Update post
var a:Array = ; for each (var k:ItemReference in pendingNewTags) a.push(k); tagService.serviceControl.commit(a);
What should i pass instead of my ItemReferences ??