diff -r 806e57d67020 -r e54dfe4d0b2b vendor/bundles/FOS/UserBundle/CouchDocument/GroupManager.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/bundles/FOS/UserBundle/CouchDocument/GroupManager.php Fri Sep 30 11:24:53 2011 +0200 @@ -0,0 +1,90 @@ +dm = $dm; + $this->repository = $dm->getRepository($class); + + $metadata = $dm->getClassMetadata($class); + $this->class = $metadata->name; + } + + /** + * Deletes a group. + * + * @param GroupInterface $group + * @return void + */ + public function deleteGroup(GroupInterface $group) + { + $this->dm->remove($group); + $this->dm->flush(); + } + + /** + * Finds one group by the given criteria. + * + * @param array $criteria + * @return GroupInterface + */ + public function findGroupBy(array $criteria) + { + return $this->repository->findBy($criteria); + } + + /** + * Returns a collection with all user instances. + * + * @return \Traversable + */ + public function findGroups() + { + return $this->repository->findAll(); + } + + /** + * Returns the group's fully qualified class name. + * + * @return string + */ + public function getClass() + { + return $this->class; + } + + /** + * Updates a group. + * + * @param GroupInterface $group + */ + public function updateGroup(GroupInterface $group, $andFlush = true) + { + $this->dm->persist($group); + if ($andFlush) { + $this->dm->flush(); + } + } +} \ No newline at end of file