I just override the UserManager.php
of the FOSUser Bundle of Symfony2, most particularly the updateUser function (I have the last version of the bundle and last version of the framework).
Here is the function (with the debug parts) :
<?php
/**
* Updates a user.
*
* @param UserInterface $user
* @param Boolean $andFlush Whether to flush the changes (default true)
*/
public function updateUser(UserInterface $user, $andFlush = true, $form = false)
{
$this->updateCanonicalFields($user);
$this->updatePassword($user);
if ($form !== false) {
$em = $this->objectManager;
$user->setStatus($em->getRepository('BirdOfficeBundle:Status')->find(1));
$language = $em->getRepository('BirdOfficeBundle:Language')->getLanguage(1);
echo '<pre>';
var_dump($language);die();
//$user->setLanguage($em->getRepository('BirdOfficeBundle:Language')->find(1));
//$user->setType($em->getRepository('BirdOfficeBundle:Type')->find(1));
echo '<pre>';var_dump($user);die();
}
$this->objectManager->persist($user);
if ($andFlush) {
$this->objectManager->flush();
}
}
?>
What I want to do with this function is to call it from my RegistrationController.php
(registerAction method) after the submit of my register form.
The problem is the following :
When I set my status, it's working very well. When I try to use the find method from other repositories (like Langue, Type, or whatever), my web browser crash.
I tried to use it in another controller, for test, and it works very well.
So, what can be the problem ?
By the way, I tried to use findAll or personal queries, but it crashes too.
I checked my dev.log
file, and there is no event.ERROR
in it.