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 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
18 changes: 18 additions & 0 deletions 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,6 +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;
}

public function eraseCredentials()
{
}

// other methods, including security methods like getRoles()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we make these changes, we'll need to reword or remove this comment too:

// other methods, including security methods like getRoles()

Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

}
Expand Down