| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 | 
							- <?php
 - 
 - /*
 -  * This file is part of the FOSUserBundle package.
 -  *
 -  * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
 -  *
 -  * For the full copyright and license information, please view the LICENSE
 -  * file that was distributed with this source code.
 -  */
 - 
 - namespace FOS\UserBundle\Doctrine;
 - 
 - use Doctrine\Common\Persistence\ObjectManager;
 - use FOS\UserBundle\Model\UserInterface;
 - use FOS\UserBundle\Model\UserManager as BaseUserManager;
 - use FOS\UserBundle\Util\CanonicalizerInterface;
 - use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
 - 
 - class UserManager extends BaseUserManager
 - {
 -     protected $objectManager;
 -     protected $class;
 -     protected $repository;
 - 
 -     /**
 -      * Constructor.
 -      *
 -      * @param EncoderFactoryInterface $encoderFactory
 -      * @param CanonicalizerInterface  $usernameCanonicalizer
 -      * @param CanonicalizerInterface  $emailCanonicalizer
 -      * @param ObjectManager           $om
 -      * @param string                  $class
 -      */
 -     public function __construct(EncoderFactoryInterface $encoderFactory, CanonicalizerInterface $usernameCanonicalizer, CanonicalizerInterface $emailCanonicalizer, ObjectManager $om, $class)
 -     {
 -         parent::__construct($encoderFactory, $usernameCanonicalizer, $emailCanonicalizer);
 - 
 -         $this->objectManager = $om;
 -         $this->repository = $om->getRepository($class);
 - 
 -         $metadata = $om->getClassMetadata($class);
 -         $this->class = $metadata->getName();
 -     }
 - 
 -     /**
 -      * {@inheritDoc}
 -      */
 -     public function deleteUser(UserInterface $user)
 -     {
 -         $this->objectManager->remove($user);
 -         $this->objectManager->flush();
 -     }
 - 
 -     /**
 -      * {@inheritDoc}
 -      */
 -     public function getClass()
 -     {
 -         return $this->class;
 -     }
 - 
 -     /**
 -      * {@inheritDoc}
 -      */
 -     public function findUserBy(array $criteria)
 -     {
 -         return $this->repository->findOneBy($criteria);
 -     }
 - 
 -     /**
 -      * {@inheritDoc}
 -      */
 -     public function findUsers()
 -     {
 -         return $this->repository->findAll();
 -     }
 - 
 -     /**
 -      * {@inheritDoc}
 -      */
 -     public function reloadUser(UserInterface $user)
 -     {
 -         $this->objectManager->refresh($user);
 -     }
 - 
 -     /**
 -      * Updates a user.
 -      *
 -      * @param UserInterface $user
 -      * @param Boolean       $andFlush Whether to flush the changes (default true)
 -      */
 -     public function updateUser(UserInterface $user, $andFlush = true)
 -     {
 -         $this->updateCanonicalFields($user);
 -         $this->updatePassword($user);
 - 
 -         $this->objectManager->persist($user);
 -         if ($andFlush) {
 -             $this->objectManager->flush();
 -         }
 -     }
 - }
 
 
  |