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

Upgrade User entity to be compatible with Symfony 6 #6582

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ The Symfony 4.4 compatibility service
`Sulu\Bundle\WebsiteBundle\Controller\ExceptionController` / `sulu_website.exception_controller`
was removed. See also [UPGRADE 2.1.0-RC1](#210-rc1).

### User entity method return types changed

The sulu `User` entity required to be changed from:
Prokyonn marked this conversation as resolved.
Show resolved Hide resolved

```diff
-public function getRoles();
+public function getRoles(): array;
-public function isEqualTo(SymfonyUserInterface $user);
+public function isEqualTo(SymfonyUserInterface $user): bool;
```

### WebsiteController methods removed and return types changed

Symfony 6 has deprecated and removed the `get` and `has` methods to access services.
Expand Down Expand Up @@ -61,7 +72,7 @@ The following service changed its definition:
- `sulu_security.command.create_user`
- `sulu_security.resetting_controller`

They require now `sulu_security.encoder_factory` instead of `sulu_security.encoder_factory`.
They require now `sulu_security.encoder_factory` instead of `security.encoder_factory`.

### Kernel Return Types changed

Expand Down
4 changes: 2 additions & 2 deletions src/Sulu/Bundle/SecurityBundle/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ public function getPasswordResetTokenEmailsSent()
return $this->passwordResetTokenEmailsSent;
}

public function isEqualTo(SymfonyUserInterface $user)
public function isEqualTo(SymfonyUserInterface $user): bool
{
if (!$user instanceof self) {
return false;
Expand Down Expand Up @@ -561,7 +561,7 @@ public function getUserRoles()
* @VirtualProperty
* @Groups({"frontend"})
*/
public function getRoles()
public function getRoles(): array
{
$roles = ['ROLE_USER'];

Expand Down