Skip to content

Commit c344b29

Browse files
committed
Merge pull request #59 from gregorybesson/develop
It's now possible to register a new user with a custom register form
2 parents 222c734 + cc1808d commit c344b29

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/PlaygroundUser/Service/User.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,15 +313,21 @@ public function edit(array $data, $user)
313313
* Register the user (associated with a default). It can be a social registration
314314
*
315315
* @param array $data
316+
* @param string $formClass
316317
* @return \playgroundUser\Entity\UserInterface
317318
* @throws Exception\InvalidArgumentException
318319
*/
319-
public function register(array $data)
320+
public function register(array $data, $formClass=false)
320321
{
321322
$zfcUserOptions = $this->getServiceManager()->get('zfcuser_module_options');
322323
$class = $zfcUserOptions->getUserEntityClass();
323324
$user = new $class;
324-
$form = $this->getRegisterForm();
325+
326+
if($formClass){
327+
$form = $this->getServiceManager()->get($formClass);
328+
} else {
329+
$form = $this->getRegisterForm();
330+
}
325331
$form->get('dob')->setOptions(array('format' => 'Y-m-d'));
326332

327333
// Convert birth date format

0 commit comments

Comments
 (0)