Symfony controller to register and activate users











up vote
0
down vote

favorite












I've been in an interview some time ago. They objected my Symfony API code with following line:




Too much code in controller actions. Can be moved to services to keep
the business logic apart from the representation. Also violating
single responsibility.




I have been trying to improve my code since then. Trying to bring SOLID in my code design and writing services for different tasks.



Now I am working on an app where I have written a controller. It still looks bulky even though it is just using services.



There are two methods:




  1. Register, to register user, add user to database and send activation code to their email

  2. Activate, get activation code from URL and activate the user or show error.


I want to know if there is any room for improvement here.



namespace AppController;

use AppEntityUser;
use AppFormUserType;
use AppSerializerFormErrorSerializer;
use AppUtilsActivationKeyManager;
use DoctrineORMEntityManagerInterface;
use SymfonyBundleFrameworkBundleControllerAbstractController;
use SymfonyComponentHttpFoundationJsonResponse;
use SymfonyComponentHttpFoundationRequest;
use SymfonyComponentHttpFoundationResponse;
use SymfonyComponentRoutingGeneratorUrlGenerator;
use SymfonyComponentSecurityCoreEncoderUserPasswordEncoderInterface;
use SymfonyComponentTranslationTranslatorInterface;

/**
* Class AuthController
* @package AppController
*/
class AuthController extends AbstractController
{
/**
* @param Request $request
* @param TranslatorInterface $translator
* @param EntityManagerInterface $em
* @param UserPasswordEncoderInterface $encoder
* @param FormErrorSerializer $formErrorSerializer
* @param ActivationKeyManager $activationKeyManager
* @param Swift_Mailer $mailer
* @return JsonResponse
*/
public function register(
Request $request,
TranslatorInterface $translator,
EntityManagerInterface $em,
UserPasswordEncoderInterface $encoder,
FormErrorSerializer $formErrorSerializer,
ActivationKeyManager $activationKeyManager,
Swift_Mailer $mailer
) : JsonResponse {
$form = $this->createForm(UserType::class);
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
/**
* @var User $user
*/
$user = $form->getData();
$encoded = $encoder->encodePassword($user, $user->getPlainPassword());
$user->setPassword($encoded);
$em->persist( $user );
$em->flush();

$activationLink = $this->generateUrl(
'activate',
[
'code' => $activationKeyManager->getKey($user),
'user' => $user->getId()
],
UrlGenerator::ABSOLUTE_URL
);
$message = (new Swift_Message($translator->trans('Activate your account')))
->setFrom($this->getParameter('admin_email'))
->setTo($user->getEmail())
->setBody(
$this->renderView(
'emails/registration.txt.twig',
['activationLink' => $activationLink]
),
'text/plain'
);

$mailer->send($message);

return new JsonResponse(['status' => 'success' , 'details' => $translator->trans('User has been created successfully.')]);
}

return new JsonResponse(['status' => 'error' , 'details' => $formErrorSerializer->convertFormToArray($form)], Response::HTTP_BAD_REQUEST);
}

/**
* @param Request $request
* @param TranslatorInterface $translator
* @param EntityManagerInterface $em
* @param ActivationKeyManager $activationKeyManager
* @return JsonResponse
*/
public function activate(
Request $request,
TranslatorInterface $translator,
EntityManagerInterface $em,
ActivationKeyManager $activationKeyManager
) {
$user_id = $request->get('user');
$activationCode = $request->get('code');

if (!$user_id || !$activationCode) {
return $this->sendInvalidActionCodeResponse($translator);
}
/**
* @var User $user
*/
$user = $em->getRepository(User::class)->find($user_id);
if (!$user) {
return $this->sendInvalidActionCodeResponse($translator);
}

if ($activationKeyManager->keyIsValid($user, $activationCode)) {
$user->setActive(true);
$em->flush($user);
return new JsonResponse(['status' => 'success' , 'details' => $translator->trans('Your account has been activated.')]);
} else {
return $this->sendInvalidActionCodeResponse($translator);
}
}

/**
* @param TranslatorInterface $translator
* @return JsonResponse
*/
private function sendInvalidActionCodeResponse(TranslatorInterface $translator)
{
return new JsonResponse(['status' => 'error' , 'details' => $translator->trans('The provided activation code is not valid.')], Response::HTTP_BAD_REQUEST);
}
}









share|improve this question









New contributor




EresDev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Can you be more specific in your title and description? "Controller" is a very broad purpose for your code!
    – Toby Speight
    yesterday










  • @TobySpeight I am not sure how can I be more specific. Symfony is an MVC framework and the above code is of a controller in which each public method above handles a specific request and produces response for that request with the help of services.
    – EresDev
    yesterday










  • What distinguishes your controller from any other? I don't know the library or language, but if there was only one reasonable controller, wouldn't that just be provided?
    – Toby Speight
    yesterday










  • Here is how Symfony defines a controller: "A controller is a PHP function you create that reads information from the Request object and creates and returns a Response object. The response could be an HTML page, JSON, XML, a file download, a redirect, a 404 error or anything else you can dream up. The controller executes whatever arbitrary logic your application needs to render the content of a page." My controller can be different from other controller only by being better that is, doing minimum number of tasks by itself and assigning maximum tasks to other services (classes).
    – EresDev
    yesterday










  • There is going to be a different controller for almost every different request (user registeration, user sign in, newsletter, contact etc.) So, no there is not going to be only one controller.
    – EresDev
    yesterday















up vote
0
down vote

favorite












I've been in an interview some time ago. They objected my Symfony API code with following line:




Too much code in controller actions. Can be moved to services to keep
the business logic apart from the representation. Also violating
single responsibility.




I have been trying to improve my code since then. Trying to bring SOLID in my code design and writing services for different tasks.



Now I am working on an app where I have written a controller. It still looks bulky even though it is just using services.



There are two methods:




  1. Register, to register user, add user to database and send activation code to their email

  2. Activate, get activation code from URL and activate the user or show error.


I want to know if there is any room for improvement here.



namespace AppController;

use AppEntityUser;
use AppFormUserType;
use AppSerializerFormErrorSerializer;
use AppUtilsActivationKeyManager;
use DoctrineORMEntityManagerInterface;
use SymfonyBundleFrameworkBundleControllerAbstractController;
use SymfonyComponentHttpFoundationJsonResponse;
use SymfonyComponentHttpFoundationRequest;
use SymfonyComponentHttpFoundationResponse;
use SymfonyComponentRoutingGeneratorUrlGenerator;
use SymfonyComponentSecurityCoreEncoderUserPasswordEncoderInterface;
use SymfonyComponentTranslationTranslatorInterface;

/**
* Class AuthController
* @package AppController
*/
class AuthController extends AbstractController
{
/**
* @param Request $request
* @param TranslatorInterface $translator
* @param EntityManagerInterface $em
* @param UserPasswordEncoderInterface $encoder
* @param FormErrorSerializer $formErrorSerializer
* @param ActivationKeyManager $activationKeyManager
* @param Swift_Mailer $mailer
* @return JsonResponse
*/
public function register(
Request $request,
TranslatorInterface $translator,
EntityManagerInterface $em,
UserPasswordEncoderInterface $encoder,
FormErrorSerializer $formErrorSerializer,
ActivationKeyManager $activationKeyManager,
Swift_Mailer $mailer
) : JsonResponse {
$form = $this->createForm(UserType::class);
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
/**
* @var User $user
*/
$user = $form->getData();
$encoded = $encoder->encodePassword($user, $user->getPlainPassword());
$user->setPassword($encoded);
$em->persist( $user );
$em->flush();

$activationLink = $this->generateUrl(
'activate',
[
'code' => $activationKeyManager->getKey($user),
'user' => $user->getId()
],
UrlGenerator::ABSOLUTE_URL
);
$message = (new Swift_Message($translator->trans('Activate your account')))
->setFrom($this->getParameter('admin_email'))
->setTo($user->getEmail())
->setBody(
$this->renderView(
'emails/registration.txt.twig',
['activationLink' => $activationLink]
),
'text/plain'
);

$mailer->send($message);

return new JsonResponse(['status' => 'success' , 'details' => $translator->trans('User has been created successfully.')]);
}

return new JsonResponse(['status' => 'error' , 'details' => $formErrorSerializer->convertFormToArray($form)], Response::HTTP_BAD_REQUEST);
}

/**
* @param Request $request
* @param TranslatorInterface $translator
* @param EntityManagerInterface $em
* @param ActivationKeyManager $activationKeyManager
* @return JsonResponse
*/
public function activate(
Request $request,
TranslatorInterface $translator,
EntityManagerInterface $em,
ActivationKeyManager $activationKeyManager
) {
$user_id = $request->get('user');
$activationCode = $request->get('code');

if (!$user_id || !$activationCode) {
return $this->sendInvalidActionCodeResponse($translator);
}
/**
* @var User $user
*/
$user = $em->getRepository(User::class)->find($user_id);
if (!$user) {
return $this->sendInvalidActionCodeResponse($translator);
}

if ($activationKeyManager->keyIsValid($user, $activationCode)) {
$user->setActive(true);
$em->flush($user);
return new JsonResponse(['status' => 'success' , 'details' => $translator->trans('Your account has been activated.')]);
} else {
return $this->sendInvalidActionCodeResponse($translator);
}
}

/**
* @param TranslatorInterface $translator
* @return JsonResponse
*/
private function sendInvalidActionCodeResponse(TranslatorInterface $translator)
{
return new JsonResponse(['status' => 'error' , 'details' => $translator->trans('The provided activation code is not valid.')], Response::HTTP_BAD_REQUEST);
}
}









share|improve this question









New contributor




EresDev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Can you be more specific in your title and description? "Controller" is a very broad purpose for your code!
    – Toby Speight
    yesterday










  • @TobySpeight I am not sure how can I be more specific. Symfony is an MVC framework and the above code is of a controller in which each public method above handles a specific request and produces response for that request with the help of services.
    – EresDev
    yesterday










  • What distinguishes your controller from any other? I don't know the library or language, but if there was only one reasonable controller, wouldn't that just be provided?
    – Toby Speight
    yesterday










  • Here is how Symfony defines a controller: "A controller is a PHP function you create that reads information from the Request object and creates and returns a Response object. The response could be an HTML page, JSON, XML, a file download, a redirect, a 404 error or anything else you can dream up. The controller executes whatever arbitrary logic your application needs to render the content of a page." My controller can be different from other controller only by being better that is, doing minimum number of tasks by itself and assigning maximum tasks to other services (classes).
    – EresDev
    yesterday










  • There is going to be a different controller for almost every different request (user registeration, user sign in, newsletter, contact etc.) So, no there is not going to be only one controller.
    – EresDev
    yesterday













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I've been in an interview some time ago. They objected my Symfony API code with following line:




Too much code in controller actions. Can be moved to services to keep
the business logic apart from the representation. Also violating
single responsibility.




I have been trying to improve my code since then. Trying to bring SOLID in my code design and writing services for different tasks.



Now I am working on an app where I have written a controller. It still looks bulky even though it is just using services.



There are two methods:




  1. Register, to register user, add user to database and send activation code to their email

  2. Activate, get activation code from URL and activate the user or show error.


I want to know if there is any room for improvement here.



namespace AppController;

use AppEntityUser;
use AppFormUserType;
use AppSerializerFormErrorSerializer;
use AppUtilsActivationKeyManager;
use DoctrineORMEntityManagerInterface;
use SymfonyBundleFrameworkBundleControllerAbstractController;
use SymfonyComponentHttpFoundationJsonResponse;
use SymfonyComponentHttpFoundationRequest;
use SymfonyComponentHttpFoundationResponse;
use SymfonyComponentRoutingGeneratorUrlGenerator;
use SymfonyComponentSecurityCoreEncoderUserPasswordEncoderInterface;
use SymfonyComponentTranslationTranslatorInterface;

/**
* Class AuthController
* @package AppController
*/
class AuthController extends AbstractController
{
/**
* @param Request $request
* @param TranslatorInterface $translator
* @param EntityManagerInterface $em
* @param UserPasswordEncoderInterface $encoder
* @param FormErrorSerializer $formErrorSerializer
* @param ActivationKeyManager $activationKeyManager
* @param Swift_Mailer $mailer
* @return JsonResponse
*/
public function register(
Request $request,
TranslatorInterface $translator,
EntityManagerInterface $em,
UserPasswordEncoderInterface $encoder,
FormErrorSerializer $formErrorSerializer,
ActivationKeyManager $activationKeyManager,
Swift_Mailer $mailer
) : JsonResponse {
$form = $this->createForm(UserType::class);
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
/**
* @var User $user
*/
$user = $form->getData();
$encoded = $encoder->encodePassword($user, $user->getPlainPassword());
$user->setPassword($encoded);
$em->persist( $user );
$em->flush();

$activationLink = $this->generateUrl(
'activate',
[
'code' => $activationKeyManager->getKey($user),
'user' => $user->getId()
],
UrlGenerator::ABSOLUTE_URL
);
$message = (new Swift_Message($translator->trans('Activate your account')))
->setFrom($this->getParameter('admin_email'))
->setTo($user->getEmail())
->setBody(
$this->renderView(
'emails/registration.txt.twig',
['activationLink' => $activationLink]
),
'text/plain'
);

$mailer->send($message);

return new JsonResponse(['status' => 'success' , 'details' => $translator->trans('User has been created successfully.')]);
}

return new JsonResponse(['status' => 'error' , 'details' => $formErrorSerializer->convertFormToArray($form)], Response::HTTP_BAD_REQUEST);
}

/**
* @param Request $request
* @param TranslatorInterface $translator
* @param EntityManagerInterface $em
* @param ActivationKeyManager $activationKeyManager
* @return JsonResponse
*/
public function activate(
Request $request,
TranslatorInterface $translator,
EntityManagerInterface $em,
ActivationKeyManager $activationKeyManager
) {
$user_id = $request->get('user');
$activationCode = $request->get('code');

if (!$user_id || !$activationCode) {
return $this->sendInvalidActionCodeResponse($translator);
}
/**
* @var User $user
*/
$user = $em->getRepository(User::class)->find($user_id);
if (!$user) {
return $this->sendInvalidActionCodeResponse($translator);
}

if ($activationKeyManager->keyIsValid($user, $activationCode)) {
$user->setActive(true);
$em->flush($user);
return new JsonResponse(['status' => 'success' , 'details' => $translator->trans('Your account has been activated.')]);
} else {
return $this->sendInvalidActionCodeResponse($translator);
}
}

/**
* @param TranslatorInterface $translator
* @return JsonResponse
*/
private function sendInvalidActionCodeResponse(TranslatorInterface $translator)
{
return new JsonResponse(['status' => 'error' , 'details' => $translator->trans('The provided activation code is not valid.')], Response::HTTP_BAD_REQUEST);
}
}









share|improve this question









New contributor




EresDev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I've been in an interview some time ago. They objected my Symfony API code with following line:




Too much code in controller actions. Can be moved to services to keep
the business logic apart from the representation. Also violating
single responsibility.




I have been trying to improve my code since then. Trying to bring SOLID in my code design and writing services for different tasks.



Now I am working on an app where I have written a controller. It still looks bulky even though it is just using services.



There are two methods:




  1. Register, to register user, add user to database and send activation code to their email

  2. Activate, get activation code from URL and activate the user or show error.


I want to know if there is any room for improvement here.



namespace AppController;

use AppEntityUser;
use AppFormUserType;
use AppSerializerFormErrorSerializer;
use AppUtilsActivationKeyManager;
use DoctrineORMEntityManagerInterface;
use SymfonyBundleFrameworkBundleControllerAbstractController;
use SymfonyComponentHttpFoundationJsonResponse;
use SymfonyComponentHttpFoundationRequest;
use SymfonyComponentHttpFoundationResponse;
use SymfonyComponentRoutingGeneratorUrlGenerator;
use SymfonyComponentSecurityCoreEncoderUserPasswordEncoderInterface;
use SymfonyComponentTranslationTranslatorInterface;

/**
* Class AuthController
* @package AppController
*/
class AuthController extends AbstractController
{
/**
* @param Request $request
* @param TranslatorInterface $translator
* @param EntityManagerInterface $em
* @param UserPasswordEncoderInterface $encoder
* @param FormErrorSerializer $formErrorSerializer
* @param ActivationKeyManager $activationKeyManager
* @param Swift_Mailer $mailer
* @return JsonResponse
*/
public function register(
Request $request,
TranslatorInterface $translator,
EntityManagerInterface $em,
UserPasswordEncoderInterface $encoder,
FormErrorSerializer $formErrorSerializer,
ActivationKeyManager $activationKeyManager,
Swift_Mailer $mailer
) : JsonResponse {
$form = $this->createForm(UserType::class);
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
/**
* @var User $user
*/
$user = $form->getData();
$encoded = $encoder->encodePassword($user, $user->getPlainPassword());
$user->setPassword($encoded);
$em->persist( $user );
$em->flush();

$activationLink = $this->generateUrl(
'activate',
[
'code' => $activationKeyManager->getKey($user),
'user' => $user->getId()
],
UrlGenerator::ABSOLUTE_URL
);
$message = (new Swift_Message($translator->trans('Activate your account')))
->setFrom($this->getParameter('admin_email'))
->setTo($user->getEmail())
->setBody(
$this->renderView(
'emails/registration.txt.twig',
['activationLink' => $activationLink]
),
'text/plain'
);

$mailer->send($message);

return new JsonResponse(['status' => 'success' , 'details' => $translator->trans('User has been created successfully.')]);
}

return new JsonResponse(['status' => 'error' , 'details' => $formErrorSerializer->convertFormToArray($form)], Response::HTTP_BAD_REQUEST);
}

/**
* @param Request $request
* @param TranslatorInterface $translator
* @param EntityManagerInterface $em
* @param ActivationKeyManager $activationKeyManager
* @return JsonResponse
*/
public function activate(
Request $request,
TranslatorInterface $translator,
EntityManagerInterface $em,
ActivationKeyManager $activationKeyManager
) {
$user_id = $request->get('user');
$activationCode = $request->get('code');

if (!$user_id || !$activationCode) {
return $this->sendInvalidActionCodeResponse($translator);
}
/**
* @var User $user
*/
$user = $em->getRepository(User::class)->find($user_id);
if (!$user) {
return $this->sendInvalidActionCodeResponse($translator);
}

if ($activationKeyManager->keyIsValid($user, $activationCode)) {
$user->setActive(true);
$em->flush($user);
return new JsonResponse(['status' => 'success' , 'details' => $translator->trans('Your account has been activated.')]);
} else {
return $this->sendInvalidActionCodeResponse($translator);
}
}

/**
* @param TranslatorInterface $translator
* @return JsonResponse
*/
private function sendInvalidActionCodeResponse(TranslatorInterface $translator)
{
return new JsonResponse(['status' => 'error' , 'details' => $translator->trans('The provided activation code is not valid.')], Response::HTTP_BAD_REQUEST);
}
}






php interview-questions mvc controller symfony2






share|improve this question









New contributor




EresDev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




EresDev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited yesterday









200_success

127k15149412




127k15149412






New contributor




EresDev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









EresDev

1012




1012




New contributor




EresDev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





EresDev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






EresDev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Can you be more specific in your title and description? "Controller" is a very broad purpose for your code!
    – Toby Speight
    yesterday










  • @TobySpeight I am not sure how can I be more specific. Symfony is an MVC framework and the above code is of a controller in which each public method above handles a specific request and produces response for that request with the help of services.
    – EresDev
    yesterday










  • What distinguishes your controller from any other? I don't know the library or language, but if there was only one reasonable controller, wouldn't that just be provided?
    – Toby Speight
    yesterday










  • Here is how Symfony defines a controller: "A controller is a PHP function you create that reads information from the Request object and creates and returns a Response object. The response could be an HTML page, JSON, XML, a file download, a redirect, a 404 error or anything else you can dream up. The controller executes whatever arbitrary logic your application needs to render the content of a page." My controller can be different from other controller only by being better that is, doing minimum number of tasks by itself and assigning maximum tasks to other services (classes).
    – EresDev
    yesterday










  • There is going to be a different controller for almost every different request (user registeration, user sign in, newsletter, contact etc.) So, no there is not going to be only one controller.
    – EresDev
    yesterday


















  • Can you be more specific in your title and description? "Controller" is a very broad purpose for your code!
    – Toby Speight
    yesterday










  • @TobySpeight I am not sure how can I be more specific. Symfony is an MVC framework and the above code is of a controller in which each public method above handles a specific request and produces response for that request with the help of services.
    – EresDev
    yesterday










  • What distinguishes your controller from any other? I don't know the library or language, but if there was only one reasonable controller, wouldn't that just be provided?
    – Toby Speight
    yesterday










  • Here is how Symfony defines a controller: "A controller is a PHP function you create that reads information from the Request object and creates and returns a Response object. The response could be an HTML page, JSON, XML, a file download, a redirect, a 404 error or anything else you can dream up. The controller executes whatever arbitrary logic your application needs to render the content of a page." My controller can be different from other controller only by being better that is, doing minimum number of tasks by itself and assigning maximum tasks to other services (classes).
    – EresDev
    yesterday










  • There is going to be a different controller for almost every different request (user registeration, user sign in, newsletter, contact etc.) So, no there is not going to be only one controller.
    – EresDev
    yesterday
















Can you be more specific in your title and description? "Controller" is a very broad purpose for your code!
– Toby Speight
yesterday




Can you be more specific in your title and description? "Controller" is a very broad purpose for your code!
– Toby Speight
yesterday












@TobySpeight I am not sure how can I be more specific. Symfony is an MVC framework and the above code is of a controller in which each public method above handles a specific request and produces response for that request with the help of services.
– EresDev
yesterday




@TobySpeight I am not sure how can I be more specific. Symfony is an MVC framework and the above code is of a controller in which each public method above handles a specific request and produces response for that request with the help of services.
– EresDev
yesterday












What distinguishes your controller from any other? I don't know the library or language, but if there was only one reasonable controller, wouldn't that just be provided?
– Toby Speight
yesterday




What distinguishes your controller from any other? I don't know the library or language, but if there was only one reasonable controller, wouldn't that just be provided?
– Toby Speight
yesterday












Here is how Symfony defines a controller: "A controller is a PHP function you create that reads information from the Request object and creates and returns a Response object. The response could be an HTML page, JSON, XML, a file download, a redirect, a 404 error or anything else you can dream up. The controller executes whatever arbitrary logic your application needs to render the content of a page." My controller can be different from other controller only by being better that is, doing minimum number of tasks by itself and assigning maximum tasks to other services (classes).
– EresDev
yesterday




Here is how Symfony defines a controller: "A controller is a PHP function you create that reads information from the Request object and creates and returns a Response object. The response could be an HTML page, JSON, XML, a file download, a redirect, a 404 error or anything else you can dream up. The controller executes whatever arbitrary logic your application needs to render the content of a page." My controller can be different from other controller only by being better that is, doing minimum number of tasks by itself and assigning maximum tasks to other services (classes).
– EresDev
yesterday












There is going to be a different controller for almost every different request (user registeration, user sign in, newsletter, contact etc.) So, no there is not going to be only one controller.
– EresDev
yesterday




There is going to be a different controller for almost every different request (user registeration, user sign in, newsletter, contact etc.) So, no there is not going to be only one controller.
– EresDev
yesterday















active

oldest

votes











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");

StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






EresDev is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f208927%2fsymfony-controller-to-register-and-activate-users%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes








EresDev is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















EresDev is a new contributor. Be nice, and check out our Code of Conduct.













EresDev is a new contributor. Be nice, and check out our Code of Conduct.












EresDev is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Code Review Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f208927%2fsymfony-controller-to-register-and-activate-users%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

List directoties down one level, excluding some named directories and files

list processes belonging to a network namespace

List all connected SSH sessions?