Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm using Migrate for importing contents from D6 to D7 and I need to create a lot of entities that have an anonymous author (uid = 0).
The problem is that whenever I set the author property = 0, the corresponding behavior set it to the user logged in, because in eck_author_property_entity_save() it checks empty($entity->{$property}) and in PHP 0 is an empty value.
Maybe it's better to check if isset() or is_null()?
Comment | File | Size | Author |
---|---|---|---|
#4 | eck-author_allow_0-2216101-4.patch | 568 bytes | Sneakyvv |
Comments
Comment #1
michaellander CreditAttribution: michaellander commentedMay need the fix from here as well #2209587: Entity properties could be empty. Will fix this and test and get back to you.
Comment #2
fmizzell CreditAttribution: fmizzell commentedComment #4
Sneakyvv CreditAttribution: Sneakyvv commentedThe problem still occurs in 7.x-2.0-rc7 and even in 7.x-2.x-dev. The proposed solution from #2209587: Entity properties could be empty has to do with form submissions in general. Even though setting the uid to 0 programmatically is not possible. The current user's uid is used instead.
The issue was introduced in #1600838: Author and Created behaviours override previously set values. It should be !isset() instead of empty(). Patch attached.
Comment #6
eric.napier CreditAttribution: eric.napier at CivicActions commentedComment #7
eric.napier CreditAttribution: eric.napier at CivicActions commentedComment #8
eric.napier CreditAttribution: eric.napier at CivicActions commented