To avoid indexation to be saved in the database, DocumentSet will no more be indexed if its parent is not nullon a ::data() call.
For a full indexation use :
For no indexation at all :
$elem->to('array', array('indexed' => false);
As discussed in #li3 it should be noted that this breaks reaching into arrays with keyed subdocuments via their key.
For example, given the following schema:
'_id' => 'id',
'name' => 'string',
'children' => array('type' => 'object', 'array' => true),
'children._id' => 'id',
'children.name' => 'string'
You could reach into the children array with their IDs:
I think this behavior is pretty handy because if you build a schema like this you most likely want to reference the child objects in another model. This makes it easy to fetch or modify the referenced subdocument. With the changes in this commit this is no longer possible.
Maybe we should find a way to preserve this functionality while fixing the issue? Was this even a feature or a positive side-effect of the issue? What do you guys think?
Since this PR concern only the ::data() exporting step, you will be able to access childrens using their ids like before:
I'm not sure DocumentSet support the -> notation.
In that case, nervermind. Seems that I misunderstood you yesterday, thanks for the fix. :)