Skip to content

Conversation

@webdevilopers
Copy link

These changes are just a proposal for solution for the following issues:

I have not edited further code since I can't tell yet what consequences this will have on

But - similar to binding the User to the CreateUser Form inside the createAction method,
this scenario works with Doctrine's ORM with OneToOne and ManyToMany relationships.

Any thoughts, @Danielss89 ?

Setter logic is replaced by binding `User` to `Form` inside controller `edit` action.
Replaces setter logic in `User` `Service`.
@webdevilopers
Copy link
Author

I just recognized that this required the zfcuser_user_hydrator to be set / used.

class Module // forminterface is automatically implemented?
{
    public function onBootstrap(MvcEvent $e)
    {
        $em = $eventManager->getSharedManager();
    $em->attach(
        'ZfcUserAdmin\Form\EditUser',
            'init',
            function($e)
            {
                /* @var $form \ZfcUser\Form\Register */
                $form = $e->getTarget();

                $sm = $form->getServiceManager();
                $om = $sm->get('Doctrine\ORM\EntityManager');

                $form->setHydrator($sm->get('zfcuser_user_hydrator'));
            }
    );
    }
}

I think this can be achieved by setting the hydrator inside the controller the way it currently happens:
https://github.com/Danielss89/ZfcUserAdmin/blob/master/src/ZfcUserAdmin/Controller/UserAdminController.php#L50

@webdevilopers
Copy link
Author

I have added the zfcuser_user_hydrator inside the controllers actions.

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

Successfully merging this pull request may close these issues.

1 participant