Closed (works as designed)
Project:
Migrate
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
29 Jan 2013 at 12:31 UTC
Updated:
1 Aug 2013 at 13:41 UTC
Jump to comment: Most recent file
Comments
Comment #1
clemens.tolboomThe attached patch made me happier but I'm not sure about the logic of the mentioned
$changedin MigrateDestinationNode::import(stdClass $node, stdClass $row)Comment #2
clemens.tolboomComment #3
mikeryanCan you describe a little more clearly what the issue is? prepare() has nothing to do with setting changed - it actually has to get set after saving the node, because node_save() insists on setting it directly.
Comment #4
helmo commentedAfter importing a set of nodes, the 'changed' date of these nodes is set to NOW().
In a content listing all nodes would have the same modification date, which is hardly useful to our editors.
We expected the 'changed' value to be equal to that of the source database.
Comment #5
mikeryanWhat does your field mapping for 'changed' look like?
Comment #6
clemens.tolboomThis is the code from a migration class
where we want to trigger the $changed if in
Comment #7
rob_johnston commentedPossibly related #1841136: Setting updated date on entities
I also see the problem of the "changed" (DB language) or "updated" (UI language) field of the node being set to the current time when migrated. However, if I import hundreds at a time I can see that this "changed" field is actually written correctly. It's only after they are all brought in that their dates are updated to the current date. The timing of this seems to correspond to the rows in the node_revision table being updated to set the "status" column from 0 to 1.
@clemens.tolboom , I bet if you change the lines in plugins/destinations/node.inc to include a watchdog statement as shown below you will see that the changed date is correct. It's something happening after this that is changing the data.
Comment #8
rob_johnston commentedI now see my problem... the node's "changed" column was being updated because my migration script is using a prepare() method to set the workbench moderation state to 'published', 'draft', or 'needs_review'. Once I stop doing that then I get the dates I expect. Don't have a good work-around yet, not even what was suggested in the related issue.
Comment #9
mikeryanOK, so not an issue in Migrate per se. To force the desired changed value after workbench has had its way with it, you'll probably need to define a hook_node_update function to reset it.
Comment #10
pgillis commentedFor those not interested in implementing the hook_node_update the attached patch leaves the changed value as what it was in the source database.
Comment #10.0
pgillis commentedUpdated issue summary.