https://g.co/gemini/share/2266895faa99


// src/Entity/User.php
namespace App\Entity;

use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;

#[Assert\GroupSequence(['User', 'Strict'])]
class User implements UserInterface
{
    #[Assert\NotBlank]
    private string $username;

    #[Assert\NotBlank]
    private string $password;

    #[Assert\IsTrue(
        message: 'The password cannot match your username',
        groups: ['Strict'],
    )]
    public function isPasswordSafe(): bool
    {
        return ($this->username !== $this->password);
    }
}


Powered by Froala Editor