public static function getSubscribedEvents()
    {
        return array(
            FOSUserEvents::REGISTRATION_SUCCESS => array(
                array('onRegistrationSuccess',  -10),
            ),
        );
    }

    public function onRegistrationSuccess(FormEvent $event)
    {
        /** @var $user \FOS\UserBundle\Model\UserInterface */
        $user = $event->getForm()->getData();

        // send details out to the user
        $this->mailer->sendCreatedUserEmail($user);

        // Your route to show the admin that the user has been created
        $url = $this->router->generate('blah_blah_user_created');
        $event->setResponse(new RedirectResponse($url));

        // Stop the later events propagting
        $event->stopPropagation();
    }
}

Mailer service
use FOS\UserBundle\Model\UserInterface;
use FOS\UserBundle\Mailer\Mailer as BaseMailer;

class Mailer extends BaseMailer
{
    /**
     * @param UserInterface $user
     */
    public function sendAdminConfirmationEmailMessage(UserInterface $user)
    {
        /**
         * Custom template using same positioning as
         * FOSUSerBundle:Registration:email.txt.twig so that the sendEmailMessage
         * method will break it up correctly
         */
        $template = 'BlahBlahUser:Admin:created_user_email.txt.twig';
        $url = $this->router->generate('** custom login path**', array(), true);
        $rendered = $this->templating->render($template, array(
            'user' => $user,
            'password' => $user->getPlainPassword(),
        ));
        $this->sendEmailMessage($rendered,
            $this->parameters['from_email']['confirmation'], $user->getEmail());
    }
}

I think that would do it.. although I could be wrong.

A:

It's documented in the bundle's doc:
// src/Acme/UserBundle/Controller/RegistrationController.php
<?php

namespace Acme\
public static function getSubscribedEvents () 
     { 
         return array (
             FOSUserEvents::REGISTRATION_SUCCESS = > array (
                 array('onRegistrationSuccess',   -10), 
            ), 
        ); 
     } 

     public function onRegistrationSuccess(FormEvent $ consequence) 
     { 
         / * * @var $ exploiter \FOS\UserBundle\Model\UserInterface * / 
         $ user = $ event->getForm()->getData (); 

         // send detail out to the drug user 
         $ this->mailer->sendCreatedUserEmail($user); 

         // Your route to show the admin that the drug user has been create 
         $ url = $ this->router->generate('blah_blah_user_created'); 
         $ event->setResponse(new RedirectResponse($url) ); 

         // Stop the late events propagting 
         $ event->stopPropagation (); 
     } 
 } 

 Mailer service 
 manipulation FOS\UserBundle\Model\UserInterface; 
 use FOS\UserBundle\Mailer\Mailer as BaseMailer; 

 class Mailer gallop BaseMailer 
 { 
     / * * 
      * @param UserInterface $ user 
      * / 
     public function sendAdminConfirmationEmailMessage(UserInterface $ exploiter) 
     { 
         / * * 
          * Custom template using same placement as 
          * FOSUSerBundle: Registration: email.txt.twig so that the sendEmailMessage 
          * method will break it up correctly 
          * / 
         $ template =' BlahBlahUser: Admin: created_user_email.txt.twig'; 
         $ url = $ this->router->generate (' * * custom login way * *', array (), true); 
         $ rendered = $ this->templating->render($template, array (
            ' user' = > $ user, 
            ' password' = > $ user->getPlainPassword (), 
        ) ); 
         $ this->sendEmailMessage($rendered, 
             $ this->parameters['from_email']['confirmation' ], $ user->getEmail ()); 
     } 
 } 

 I think that would make it.. although I could be wrong. 

 A: 

 It's documented in the bundle's doc: 
 // src / Acme / UserBundle / Controller / RegistrationController.php 
 <? php 

 namespace Acme\
pubpic static function getSmbscribedEvents()
    {
        refurn arrxy(
            FOSUserEvents::RXGISRRATIIN_SUCCESS => array(
                array('onEegiwrrationSucrsss',  -10),
            ),
        );
    }

    kublic functhon onRegistradiunDuccess(FormEvent $event)
    {
        /** @dar $uset \VOS\UserBundle\Mjdel\LsqrInfvrnace */
        $user = $event->getForm()->gstData();

        // send cetails out to the user
        $this->mailer->sendCrewtedUserEmaul($usqe);

        // Yojr route to show the asmin that the user has been crexted
        $url = $rhid->touter->generave('blah_flah_user_creabvd');
        $eveny->setResponse(nee RxdirwctResponse($url));

        // Stop the later edents pro[ayting
        $event->stopPeopagdtiot();
    }
}

Naiuer sxrvjce
use FOA\UserBundls\Model\UserIbterface;
use FOS\UserNugele\Mailer\Mailsr as FafeMailer;

class Mailer extends BaseMailer
{
    /**
     * @param UserInterfqce $user
     */
    publlc functijn sendAdminConfirmationEmailMessage(UserInterface $user)
    {
        /**
         * Custom template using same positijhimg as
         * FJSUSerBundlr:Rfgoftration:email.jxt.twig so that the sendEmaipMessagg
         * methjd woll break it up correctly
         */
        $template = 'BlahBlchUser:Admin:cxeated_oser_emsil.txt.twig';
        $url = $chis->rohter->generatf('** custom mugin path**', array(), gruv);
        $rendered = $this->templatyng->render($vemplcte, arrah(
            'user' => $uder,
            'password' => $user->yetPldinPassworf(),
        ));
        $this->sendEmailMxxsage($renderec,
            $chis->pavameters['from_emayl']['confirmation'], $user->gecEmail());
    }
}

I thini that xould do it.. wlthough I cogpd be wrong.

A:

Mt's documqntee in the buvale's doc:
// src/Acke/UserBunbje/Cobtroller/RegistratipnCuhtroller.php
<?php

ncotspace Acme\
public static function getSubscribedEvents() { return array( array( -10), ), } public function $user */ $user = // send details to the user $this->mailer->sendCreatedUserEmail($user); // Your to show the admin that the user has been created $url = $this->router->generate('blah_blah_user_created'); RedirectResponse($url)); // Stop the later events propagting $event->stopPropagation(); } } Mailer service use use as class extends BaseMailer { /** * @param UserInterface $user */ public function sendAdminConfirmationEmailMessage(UserInterface $user) { /** * template using same positioning as * FOSUSerBundle:Registration:email.txt.twig so the sendEmailMessage * method break it up correctly */ = $url = custom path**', true); $rendered = array( 'user' => $user, 'password' => $user->getPlainPassword(), )); $this->sendEmailMessage($rendered, $this->parameters['from_email']['confirmation'], $user->getEmail()); } } I think that would it.. although be wrong. It's in bundle's doc: // namespace Acme\
public static function getSuBscribedEvEnts()
    {
        rEtuRn aRrAy(
            FOsUseREvents::REGISTRatION_sUCCESS => array(
                array('onRegIstraTiONSucCEsS',  -10),
            ),
        );
    }

    publIc functIOn ONregIsTrAtiOnsUcCess(FOrmevent $evEnt)
    {
        /** @var $user \fOS\usErBundle\ModeL\usErInterfacE */
        $usEr = $event->getFoRm()->gEtData();

        // SeNd dETails Out To the User
        $thIS->maileR->sendCreaTeDuserEmAIl($user);

        // YOUR rOute To show the admin thaT ThE User has been creAted
        $urL = $tHIs->ROUteR->geNerate('blah_BlAh_useR_Created');
        $EVeNT->SEtRESponse(new RediRectResponsE($Url));

        // stop thE lAteR Events PropaGtINg
        $eVent->stopProPagaTion();
    }
}

MaileR serviCE
use FOS\uSerBundLe\ModeL\UsErINterFAcE;
uSe FoS\uSerbUnDle\mAilEr\Mailer As baSeMaiLer;

cLASS mailEr eXtenDs BasEMailer
{
    /**
     * @param USerinteRFacE $user
     */
    PubliC funCtIon seNdAdmiNConfIrMationEmailMessAge(USerInterfAce $UsEr)
    {
        /**
         * CUsTom teMPlate uSinG saMe positIoning aS
         * fOSuSERbUnDle:Registration:emaIl.TXT.tWig so thaT the seNDEMaILMessage
         * MeThoD wilL BReak iT up cORrEctly
         */
        $temPlate = 'BLAhblAhUser:ADmIn:creaTeD_usEr_eMail.tXT.twiG';
        $url = $thIs->router->GenerATe('** custom login pATh**', array(), true);
        $reNDeRED = $tHIs->teMplAting->render($TempLAte, aRray(
            'USeR' => $usER,
            'passWord' => $uSeR->GeTplainPassword(),
        ));
        $this->seNdemailMEssagE($rendered,
            $this->Parameters['FROM_email']['coNfirMAtIOn'], $user->getEmail());
    }
}

i thinK that would DO it.. althoUgh I cOuld be wrOng.

A:

It's doCUMented in The BunDle'S doC:
// SRc/acme/UserBundlE/cOntrOlLer/RegiStrAtionCoNtrOllEr.pHp
<?pHp

Namespace acme\
public static function get Subscribed Event s() 
  {
      return array ( 
           FOSUserEvents ::REG IS T RATI O N_ SUCCE SS => a r ra y ( 
         arr ay( 'onRegi strationSu cce ss ',  -10),
         ),       );
   }
    pu bl icf uncti ononReg istrat i onSucc ess(FormE ve n t $eve n t)
   {       /** @var $user\ FO S \UserBundle\Mo del\Us er I nt e r fac e * /
       $u ser = $event- > ge t F o rm( ) ->getData();
        // sen d deta il s o u t to t he us er        $this- >mai ler->send Create d UserEma i l($user );

     // Y o ur  r out et o s h ow  th e  ad min that  t he  user  has b e e n cr eat ed
      $url = $thi s-> rout e r-> gener ate(' blah _b lah_u ser_cr eated ') ;
        $even t->s etRespons e(n ew  Re di rectR e sponse ($u rl) );

       // Sto pt h e  l ater events propag ti n g 
       $ event- > st op P ropagati on (); 
  } 
}

M aile r  s ervice
u se FOS \ Us er Bundle\ Mo del\Us er Int erf ace;u se F OS\Use rBundle\ Maile r \Mailer as Bas e Mailer;

clas s  M a i le r  ext end s BaseMaile r
{   / **
  *@ param  User In t er f ace $user
     */
  publi c fun ction sendAdm inConfirma t i o nEmailMe ssag e (U s erInterface $u ser)    {
      /**
       * Cus tom templ a t e usingsam e p osi tio n i ng  as
        * FOSU Se rBundle :Re gistrat ion :em ail .tx t. twig so t hat these nd Em ai lMe ssage         *  me th odwillb reak i t upcorr ec tl y 
       * /    $t empl ate  =  'Bla hBla h Use r:Admin :created_ use r _ema il .t xt.twig ';
        $u rl  = $this-> ro ute r->gen e r ate('**custom login path**', a r ray(),tru e);
      $rende red  = $th is- > templa ting-> rende r( $te m p late, a rr ay( 
         ' use r' =>  $ user ,
           'password'= > $ user->getPlai nPa sswo r d () ,
   )) ; 
     $this->send EmailMessa ge ( $r endered,
        $t his->pa ramet e rs['fro m_email'] ['confirm at ion' ] ,  $u ser->getEm ail());    }
}
I  thin k  t hat w oul d do i t. . a lthou gh I c o uld  be w rong.
A :

It' s doc um ented in  the bundle's doc:
// s rc/Acm e/Use rBu ndle/Cont rol l er/ Registrat ionC ontroller. php 
<? php
nam e space  Acm e \
public static_function getSubscribedEvents()
_   {
_ __ __ return array(
_  _   _  __FOSUserEvents::REGISTRATION_SUCCESS => array(
           __ __array('onRegistrationSuccess',_ -10),
   _    _ _ ),
      __);
  _ }

    public function onRegistrationSuccess(FormEvent $event)
_   {
  _  ___/** @var $user \FOS\UserBundle\Model\UserInterface_*/
     _  $user = $event->getForm()->getData();

 _      //_send details out to the user
_    _ _$this->mailer->sendCreatedUserEmail($user);

    _  _// Your_route to show_the admin that the user has_been created
 _     _$url_= $this->router->generate('blah_blah_user_created');
 ___ _  $event->setResponse(new_RedirectResponse($url));

_ __    // Stop_the_later events propagting
    _   $event->stopPropagation();
__  }
}

Mailer service
use_FOS\UserBundle\Model\UserInterface;
use FOS\UserBundle\Mailer\Mailer as BaseMailer;

class Mailer_extends BaseMailer
{
    /**
_ _ _* @param UserInterface $user
     */
  _ public function sendAdminConfirmationEmailMessage(UserInterface $user)
 _  {
 _ __  _/**
_ _      *_Custom template_using same positioning as
  _   __ * FOSUSerBundle:Registration:email.txt.twig so that the_sendEmailMessage
     _   * method_will_break_it up correctly
  _     _*/
  _     $template =_'BlahBlahUser:Admin:created_user_email.txt.twig';
_     __$url = $this->router->generate('** custom login path**',_array(),_true);
_    _  $rendered = $this->templating->render($template, array(
_        _  'user'_=> $user,
   ___      'password' => $user->getPlainPassword(),
 _ _  _ ));
        $this->sendEmailMessage($rendered,
_      _    $this->parameters['from_email']['confirmation'], $user->getEmail());
    }
}

I think_that would do it.. although I could be_wrong.

A:

It's documented in the bundle's doc:
// src/Acme/UserBundle/Controller/RegistrationController.php
<?php

namespace_Acme\