Skip to content

Commit

Permalink
Upgrade User entity to be compatible with Symfony 6 (#6582)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz authored May 3, 2022
1 parent bdcec71 commit 6d884cc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
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 requires the following changes:

```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

0 comments on commit 6d884cc

Please sign in to comment.