Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sergis opened this issue Jun 13, 2016 · 0 comments
Open

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

sergis opened this issue Jun 13, 2016 · 0 comments

Comments

@sergis
Copy link

sergis commented Jun 13, 2016

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant