diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/CouchDocument/UserManager.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/CouchDocument/UserManager.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,112 @@ +dm = $dm; + $this->repository = $dm->getRepository($class); + + $metadata = $dm->getClassMetadata($class); + $this->class = $metadata->name; + } + + /** + * {@inheritDoc} + */ + public function deleteUser(UserInterface $user) + { + $this->dm->remove($user); + $this->dm->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(); + } + + /** + * 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->dm->persist($user); + if ($andFlush) { + $this->dm->flush(); + } + } + + /** + * {@inheritDoc} + */ + public function validateUnique(UserInterface $value, Constraint $constraint) + { + // for now unique checks are not implemented in Doctrine CouchDB yet + return true; + } + + public function reloadUser(UserInterface $user) + { + $this->dm->refresh($user); + } +} +