Closed (fixed)
Project:
Migrate
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Apr 2012 at 21:23 UTC
Updated:
4 May 2012 at 13:50 UTC
Currently in 7.x-2.x, I can not pass a default value of zero.
In migration::applyMappings near line 813, there's a test for $source and $default values.
// When updating existing items, make sure we don't create a destination
// field that is not mapped to anything (a source field or a default value)
if (!$source && !$default) {
continue;
}
This is a bit harsh because I may want a default value of zero to be set for a field. For example, pathauto may be enabled on my site but my initial migration of nodes are going to keep their original paths. I want to make sure that $entity->pathauto is properly set to 0 (zero). The current test will skip setting pathauto completely because !$default is true when $default = 0.
The attached patch attempts to fix this issue.
| Comment | File | Size | Author |
|---|---|---|---|
| migrate-allow-zero-default-value.patch | 562 bytes | robeano |
Comments
Comment #1
mikeryanStrange, I have an environment where setting the pathauto defaultValue seems to work, but I can reproduce this... Anyway, isset() works just fine, committed, thanks!