Skip to content

Encode a password during mapping in forMember() #76

Open
@fd6130

Description

@fd6130

To encode a password in symfony, we have to use UserPasswordEncoderInterface to encode the password. It will need to pass the User entity as first parameter for the method encodePassword().

It will be cool if we could do something like

$config->registerMapping(UserDto::class, User::class)
    ->forMember("password", function($source, $destination) use ($passwordEncoder) {
         return $passwordEncoder->encodePassword($destination, $source->password);  
   });

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