/**
* Constructor.
*
* @param string $usernameField
* the username
*
* @param string $passwordField
* the password (hash)
*
* @param string $saltField
* the password hash salt
*
* @param Entity $userEntity
* the actual user data
*
* @param array $roles
* the roles
*/
public function __construct($usernameField, $passwordField, $saltField, Entity $userEntity, array $roles)
{
$this->usernameField = $usernameField;
$this->passwordField = $passwordField;
$this->saltField = $saltField;
// We have to copy it over as symfony/security wants something serializable.
$this->userData = [];
foreach ($userEntity->getDefinition()->getFieldNames() as $field) {
$this->userData[$field] = $userEntity->get($field);
}
$this->roles = $roles;
}