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

Make the User class compatible with Symfony 6 to use encoder_name #15287

Merged
merged 3 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions UPGRADE-1.12.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# UPGRADE FROM `v1.12.11` TO `v1.12.12`

1. The `Sylius\Component\User\Model\UserInterface` extends the `Symfony\Component\PasswordHasher\Hasher\PasswordHasherAwareInterface`
interface to fix the compatibility with Symfony 6.

# UPGRADE FROM `v1.12.10` TO `v1.12.11`

1. Due to a bug that was causing the removal of promotion configurations for promotions [REF](https://github.com/Sylius/Sylius/issues/15201),
Expand Down
5 changes: 5 additions & 0 deletions src/Sylius/Component/User/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,11 @@ public function setEncoderName(?string $encoderName): void
$this->encoderName = $encoderName;
}

public function getPasswordHasherName(): ?string
{
return $this->getEncoderName();
}

/**
* The serialized data have to contain the fields used by the equals method and the username.
*/
Expand Down
4 changes: 3 additions & 1 deletion src/Sylius/Component/User/Model/UserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Sylius\Component\Resource\Model\ToggleableInterface;
use SyliusLabs\Polyfill\Symfony\Security\Core\Encoder\EncoderAwareInterface;
use SyliusLabs\Polyfill\Symfony\Security\Core\User\AdvancedUserInterface;
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherAwareInterface;

interface UserInterface extends
AdvancedUserInterface,
Expand All @@ -27,7 +28,8 @@ interface UserInterface extends
\Serializable,
TimestampableInterface,
ToggleableInterface,
EncoderAwareInterface
EncoderAwareInterface,
PasswordHasherAwareInterface
{
public const DEFAULT_ROLE = 'ROLE_USER';

Expand Down