You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Switching back to 9addf53 the behaviour returns as before.
I have an application that stores some documents, each one based on a structure describing the fields to be displayed.
To do this the DynamicDocument embeds a DynamicDocumentStructure, and the latter embeds some Field.
Templates are store in DynamicDocumentStructureTemplate, that embeds a DynamicDocumentStructure.
When I create a new DynamicDocument based on a particular template, I create a new instance of DynamicDocumentStructure, copy the Fields collection and some other data from the DynamicDocumentStructureTemplate I want to use and assign this DynamicDocumentStructure to the DynamicDocument.
Now the problem: after the update when persisting the newly created DynamicDocument, the Fields collection on the DynamicDocumentStructureTemplate is emptied.
The emphasized lines are absent using the bundle in 9addf53 or previous commit.
Now, the Structure uses the @gedmo\Timestampable annotation to keep updated datetime, so the first line should be just the jandling of the event fired.
It seems that someone deletes the Fields from the structure, and at the flush() the DM updates it phisically.
Now, my code when creating a new DynamicDocument is this:
$template = $this->get('doctrine_mongodb')
->getRepository('AcmeDynamicDocumentBundle:DynamicDocumentStructureTemplate')
->findOneById($templateid);
// check for errors
if ($template) {
$document = new DynamicDocument();
$structure = new DynamicDocumentStructure();
$structure->setName($template->getName());
$structure->setFields($template->getFields());
$document->setStructure($structure);
$dm->persist($document);
$dm->flush();
Or could be that the previous bundle behaviour was wrong? The Fields I'm copying are maybe considered not just clones of Template Fields but the Fields themselves?
In this latter case the problem is my understanding of the document's embedding, and I'm in the wrong place. But this code is working well for 2 years now...
The text was updated successfully, but these errors were encountered:
I had this issue today, and i'm trying to describe it in detail:
Foreword: my code did not change, and I had this problem afther this update:
Switching back to 9addf53 the behaviour returns as before.
I have an application that stores some documents, each one based on a structure describing the fields to be displayed.
To do this the DynamicDocument embeds a DynamicDocumentStructure, and the latter embeds some Field.
Templates are store in DynamicDocumentStructureTemplate, that embeds a DynamicDocumentStructure.
When I create a new DynamicDocument based on a particular template, I create a new instance of DynamicDocumentStructure, copy the Fields collection and some other data from the DynamicDocumentStructureTemplate I want to use and assign this DynamicDocumentStructure to the DynamicDocument.
Now the problem: after the update when persisting the newly created DynamicDocument, the Fields collection on the DynamicDocumentStructureTemplate is emptied.
Enabling the verbose log on mongodb i see this:
The emphasized lines are absent using the bundle in 9addf53 or previous commit.
Now, the Structure uses the @gedmo\Timestampable annotation to keep updated datetime, so the first line should be just the jandling of the event fired.
It seems that someone deletes the Fields from the structure, and at the flush() the DM updates it phisically.
Now, my code when creating a new DynamicDocument is this:
Or could be that the previous bundle behaviour was wrong? The Fields I'm copying are maybe considered not just clones of Template Fields but the Fields themselves?
In this latter case the problem is my understanding of the document's embedding, and I'm in the wrong place. But this code is working well for 2 years now...
The text was updated successfully, but these errors were encountered: