1 | <?php |
||
13 | class UserService |
||
14 | { |
||
15 | /** |
||
16 | * @var UserRepository |
||
17 | */ |
||
18 | private $userRepository; |
||
19 | |||
20 | /** |
||
21 | * UserService constructor. |
||
22 | * |
||
23 | * @param UserRepository $userRepository |
||
24 | */ |
||
25 | public function __construct(UserRepository $userRepository) |
||
29 | |||
30 | /** |
||
31 | * Fetches all users. |
||
32 | * |
||
33 | * @return UserEntity[] |
||
34 | */ |
||
35 | public function fetchAll() |
||
45 | |||
46 | /** |
||
47 | * Fetches a user by its id. |
||
48 | * |
||
49 | * @param int $id |
||
50 | * |
||
51 | * @return null|UserEntity |
||
52 | */ |
||
53 | public function fetchOneById($id) |
||
63 | |||
64 | public function fetchOneBy(array $where) |
||
74 | |||
75 | /** |
||
76 | * Creates a user in the database. |
||
77 | * |
||
78 | * @param UserEntity $entity |
||
79 | * |
||
80 | * @return UserEntity |
||
81 | */ |
||
82 | public function create(UserEntity $entity) |
||
86 | |||
87 | /** |
||
88 | * Update a user in the database. |
||
89 | * |
||
90 | * @param UserEntity $entity |
||
91 | * |
||
92 | * @return UserEntity |
||
93 | */ |
||
94 | public function update(UserEntity $entity) |
||
98 | |||
99 | /** |
||
100 | * Removes a user from the database. |
||
101 | * |
||
102 | * @param UserEntity $entity |
||
103 | * |
||
104 | * @return UserEntity |
||
105 | */ |
||
106 | public function remove(UserEntity $entity) |
||
110 | } |
||
111 |