sonata-project/SonataUserBundle — Issue #21: Missing userManager property (when updating user)
Author: mattsches
Created: 2011-12-27 10:50:33+00:00
State: open

As reported [here](https://groups.google.com/group/sonata-users/browse_thread/thread/23345ecf360106e4#), when trying to update an existing user in the user admin backend, a notice is thrown:

```php
Notice: Undefined property: Brickstorm\ParliamentBundle\Admin
\CitizenAdmin::$userManager in /homez.307/amndrc/www/__ac/vendor/
bundles/Sonata/UserBundle/Admin/Entity/UserAdmin.php line 83
```
This is because a) the userManager property is not defined in the class or its parent class, and b) it's not being set anywhere.

The following piece of code bypasses the problem, but might not be the best way to correctly solve this ;)

```php
class UserAdmin extends Admin
{
protected $userManager;
[...]
public function getUserManager()
{
if (!$this->userManager) {
$this->userManager = $this->configurationPool-
>getContainer()->get('fos_user.user_manager');

}
return $this->userManager;
}
}
```