mark-gerarts / mark-gerarts/automapper-plus

Encode a password during mapping in forMember()

Open
#76 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
562
Forks
32
PR merge metrics
No merged PRs in 30d

Description

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);
});
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the implementation of registerMapping() and forMember(), then inspect how the mapping callback receives the source and destination objects. Done means a forMember() callback can pass the destination User entity and source password to UserPasswordEncoderInterface::encodePassword().

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.