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

Skip to content

Commit 95f4f9c

Browse files
committed
minor symfony#9724 Add mandatory method and attribute (razbounak)
This PR was squashed before being merged into the 2.7 branch (closes symfony#9724). Discussion ---------- Add mandatory method and attribute For the page "Implement a Simple Registration Form" Without $roles, construct(), getRoles() and eraseCredentials(), this entity doesn't work because of his interface It may be nice to add these methods so that you do not have any errors when you copy paste Commits ------- 9ddb69d Add mandatory method and attribute
2 parents 8b3a7ca + 9ddb69d commit 95f4f9c

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

doctrine/registration_form.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ With some validation added, your class may look something like this::
8787
* @ORM\Column(type="string", length=64)
8888
*/
8989
private $password;
90+
91+
/**
92+
* @ORM\Column(type="array")
93+
*/
94+
private $roles;
95+
96+
public function __construct() {
97+
$this->roles = array('ROLE_USER');
98+
}
9099

91100
// other properties and methods
92101

@@ -136,8 +145,15 @@ With some validation added, your class may look something like this::
136145
// You *may* need a real salt if you choose a different encoder.
137146
return null;
138147
}
148+
149+
public function getRoles()
150+
{
151+
return $this->roles;
152+
}
139153

140-
// other methods, including security methods like getRoles()
154+
public function eraseCredentials()
155+
{
156+
}
141157
}
142158

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

0 commit comments

Comments
 (0)