vendor/bundles/FOS/UserBundle/Model/UserManagerInterface.php
changeset 3 e54dfe4d0b2b
equal deleted inserted replaced
2:806e57d67020 3:e54dfe4d0b2b
       
     1 <?php
       
     2 
       
     3 /*
       
     4  * This file is part of the FOSUserBundle package.
       
     5  *
       
     6  * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
       
     7  *
       
     8  * For the full copyright and license information, please view the LICENSE
       
     9  * file that was distributed with this source code.
       
    10  */
       
    11 
       
    12 namespace FOS\UserBundle\Model;
       
    13 
       
    14 use Symfony\Component\Validator\Constraint;
       
    15 
       
    16 /**
       
    17  * Interface to be implemented by user managers. This adds an additional level
       
    18  * of abstraction between your application, and the actual repository.
       
    19  *
       
    20  * All changes to users should happen through this interface.
       
    21  *
       
    22  * The class also contains ACL annotations which will only work if you have the
       
    23  * SecurityExtraBundle installed, otherwise they will simply be ignored.
       
    24  *
       
    25  * @author Gordon Franke <info@nevalon.de>
       
    26  * @author Thibault Duplessis <thibault.duplessis@gmail.com>
       
    27  * @author Johannes M. Schmitt <schmittjoh@gmail.com>
       
    28  */
       
    29 interface UserManagerInterface
       
    30 {
       
    31     /**
       
    32      * Creates an empty user instance.
       
    33      *
       
    34      * @return UserInterface
       
    35      */
       
    36     function createUser();
       
    37 
       
    38     /**
       
    39      * Deletes a user.
       
    40      *
       
    41      * @param UserInterface $user
       
    42      */
       
    43     function deleteUser(UserInterface $user);
       
    44 
       
    45     /**
       
    46      * Finds one user by the given criteria.
       
    47      *
       
    48      * @param array $criteria
       
    49      * @return UserInterface
       
    50      */
       
    51     function findUserBy(array $criteria);
       
    52 
       
    53     /**
       
    54      * Find a user by its username.
       
    55      *
       
    56      * @param string  $username
       
    57      * @return UserInterface or null if user does not exist
       
    58      */
       
    59     function findUserByUsername($username);
       
    60 
       
    61     /**
       
    62      * Finds a user by its email.
       
    63      *
       
    64      * @param string  $email
       
    65      * @return UserInterface or null if user does not exist
       
    66      */
       
    67     function findUserByEmail($email);
       
    68 
       
    69     /**
       
    70      * Finds a user by its username or email.
       
    71      *
       
    72      * @param string  $usernameOrEmail
       
    73      * @return UserInterface or null if user does not exist
       
    74      */
       
    75     function findUserByUsernameOrEmail($usernameOrEmail);
       
    76 
       
    77     /**
       
    78      * Finds a user by its confirmationToken.
       
    79      *
       
    80      * @param string  $token
       
    81      * @return UserInterface or null if user does not exist
       
    82      */
       
    83     function findUserByConfirmationToken($token);
       
    84 
       
    85     /**
       
    86      * Returns a collection with all user instances.
       
    87      *
       
    88      * @return \Traversable
       
    89      */
       
    90     function findUsers();
       
    91 
       
    92     /**
       
    93      * Returns the user's fully qualified class name.
       
    94      *
       
    95      * @return string
       
    96      */
       
    97     function getClass();
       
    98 
       
    99     /**
       
   100      * Reloads a user.
       
   101      *
       
   102      * @param UserInterface $user
       
   103      */
       
   104     function reloadUser(UserInterface $user);
       
   105 
       
   106     /**
       
   107      * Updates a user.
       
   108      *
       
   109      * @param UserInterface $user
       
   110      */
       
   111     function updateUser(UserInterface $user);
       
   112 
       
   113     /**
       
   114      * Updates the canonical username and email fields for a user.
       
   115      *
       
   116      * @param UserInterface $user
       
   117      */
       
   118     function updateCanonicalFields(UserInterface $user);
       
   119 
       
   120     /**
       
   121      * Updates a user password if a plain password is set.
       
   122      *
       
   123      * @param UserInterface $user
       
   124      */
       
   125     function updatePassword(UserInterface $user);
       
   126 
       
   127     /**
       
   128      * Checks the uniqueness of the given fields, returns true if its unique.
       
   129      *
       
   130      * @param UserInterface $value
       
   131      * @param Constraint $constraint
       
   132      * @return Boolean
       
   133      */
       
   134     function validateUnique(UserInterface $value, Constraint $constraint);
       
   135 }