Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add mandatory method and attribute #9724

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

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
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
18 changes: 17 additions & 1 deletion doctrine/registration_form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ With some validation added, your class may look something like this::
* @ORM\Column(type="string", length=64)
*/
private $password;

/**
* @ORM\Column(type="array")
*/
private $roles;

public function __construct() {
$this->roles = array('ROLE_USER');
}

// other properties and methods

Expand Down Expand Up @@ -136,8 +145,15 @@ With some validation added, your class may look something like this::
// You *may* need a real salt if you choose a different encoder.
return null;
}

public function getRoles()
{
return $this->roles;
}

// other methods, including security methods like getRoles()
public function eraseCredentials()
{
}
}

The :class:`Symfony\\Component\\Security\\Core\\User\\UserInterface` requires
Expand Down