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()?

CommentFileSizeAuthor
#4 eck-author_allow_0-2216101-4.patch568 bytesSneakyvv
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

michaellander’s picture

Assigned: Unassigned » michaellander

May need the fix from here as well #2209587: Entity properties could be empty. Will fix this and test and get back to you.

fmizzell’s picture

Version: 7.x-2.0-rc2 » 7.x-2.x-dev
Assigned: michaellander » Unassigned
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Sneakyvv’s picture

Status: Closed (fixed) » Needs review
FileSize
568 bytes

The 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.

  • eric.napier committed 67d9f5c on 7.x-2.x authored by Sneakyvv
    Issue #2216101 by Sneakyvv: Author property cannot be set to 0 when...
eric.napier’s picture

Status: Needs review » Reviewed & tested by the community
eric.napier’s picture

Status: Reviewed & tested by the community » Fixed
eric.napier’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.