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

DomainObjectsDataMapper works only for value objects #32

Open
Nek- opened this issue Aug 11, 2019 · 0 comments
Open

DomainObjectsDataMapper works only for value objects #32

Nek- opened this issue Aug 11, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@Nek-
Copy link
Contributor

Nek- commented Aug 11, 2019

DomainObjectsDataMapper is used as default data mapper but works only for value objects. It may be a good idea to verify if the current objet is not a value object and keep the old object in this case.

    public function mapFormsToData($forms, &$data)
    {
        if ($data instanceof CrudableModelInterface) {
            return $data;
        }
        $data = $this->createObject($forms, !empty($data) && is_object($data) ? get_class($data) : null);
        parent::mapFormsToData($forms, $data);
    }

Maybe this piece of code is a good idea. I'm not sure it's actually is but well. We need to think about.

In any case, considering the option "customDataMapper", there's no problem that the default datamapper does not support every case.

@Nek- Nek- added the enhancement New feature or request label Aug 11, 2019
Nek- added a commit to Nek-/Melodiia that referenced this issue Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant