Skip to content

DoctrineWriter->UpdateEntity doesn't nullify entity properties #303

@sergis

Description

@sergis

In case of update existing doctrine entity I cannot nullify target property even if it exists but set empty in importing item.
the most annoying case is for datetime item values :(
I suppose the following statement in DoctrineWriter->UpdateEntity()

            if (isset($item[$fieldName])) {
                $value = $item[$fieldName];
            } elseif (method_exists($item, 'get' . ucfirst($fieldName))) {
                $value = $item->{'get' . ucfirst($fieldName)};
            }
            if (null === $value) {
                continue;
            }

should be replaced to

            if (array_key_exists($fieldName,$item)) {
                $value = $item[$fieldName];
            } elseif (method_exists($item, 'get' . ucfirst($fieldName))) {
                $value = $item->{'get' . ucfirst($fieldName)};
            } else {
           continue;
         }

Would you please explain if I'm wrong for some reasons?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions