@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | public function run(): void |
| 12 | 12 | { |
| 13 | - //Action when run the seed |
|
| 13 | + //Action when run the seed |
|
| 14 | 14 | |
| 15 | 15 | $data = [ |
| 16 | 16 | 0 => [ |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | public function run(): void |
| 12 | 12 | { |
| 13 | - //Action when run the seed |
|
| 13 | + //Action when run the seed |
|
| 14 | 14 | |
| 15 | 15 | $data = [ |
| 16 | 16 | 0 => [ |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | public function run(): void |
| 12 | 12 | { |
| 13 | - //Action when run the seed |
|
| 13 | + //Action when run the seed |
|
| 14 | 14 | |
| 15 | 15 | $data = [ |
| 16 | 16 | 0 => [ |
@@ -92,10 +92,10 @@ discard block |
||
| 92 | 92 | $context = []; |
| 93 | 93 | $context['user_status'] = $this->statusList->getUserStatus(); |
| 94 | 94 | $context['total_user'] = $this->userRepository->query() |
| 95 | - ->count('id'); |
|
| 95 | + ->count('id'); |
|
| 96 | 96 | |
| 97 | 97 | $context['total_role'] = $this->roleRepository->query() |
| 98 | - ->count('id'); |
|
| 98 | + ->count('id'); |
|
| 99 | 99 | |
| 100 | 100 | $context['total_product_category'] = $this->productCategoryRepository->query() |
| 101 | 101 | ->count('id'); |
@@ -119,8 +119,8 @@ discard block |
||
| 119 | 119 | $context['product_amounts'] = $this->productRepository->query() |
| 120 | 120 | ->sum(function (Expression $e) { |
| 121 | 121 | $e->column('price') |
| 122 | - ->op('*') |
|
| 123 | - ->column('quantity'); |
|
| 122 | + ->op('*') |
|
| 123 | + ->column('quantity'); |
|
| 124 | 124 | }); |
| 125 | 125 | |
| 126 | 126 | return new TemplateResponse( |
@@ -28,15 +28,15 @@ discard block |
||
| 28 | 28 | class PermissionAction |
| 29 | 29 | { |
| 30 | 30 | /** |
| 31 | - * Create new instance |
|
| 32 | - * @param Lang $lang |
|
| 33 | - * @param Pagination $pagination |
|
| 34 | - * @param Template $template |
|
| 35 | - * @param Flash $flash |
|
| 36 | - * @param RouteHelper $routeHelper |
|
| 37 | - * @param LoggerInterface $logger |
|
| 38 | - * @param PermissionRepository $permissionRepository |
|
| 39 | - */ |
|
| 31 | + * Create new instance |
|
| 32 | + * @param Lang $lang |
|
| 33 | + * @param Pagination $pagination |
|
| 34 | + * @param Template $template |
|
| 35 | + * @param Flash $flash |
|
| 36 | + * @param RouteHelper $routeHelper |
|
| 37 | + * @param LoggerInterface $logger |
|
| 38 | + * @param PermissionRepository $permissionRepository |
|
| 39 | + */ |
|
| 40 | 40 | public function __construct( |
| 41 | 41 | protected Lang $lang, |
| 42 | 42 | protected Pagination $pagination, |
@@ -49,16 +49,16 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * List all entities |
|
| 53 | - * @param ServerRequestInterface $request |
|
| 54 | - * @return ResponseInterface |
|
| 55 | - */ |
|
| 52 | + * List all entities |
|
| 53 | + * @param ServerRequestInterface $request |
|
| 54 | + * @return ResponseInterface |
|
| 55 | + */ |
|
| 56 | 56 | public function index(ServerRequestInterface $request): ResponseInterface |
| 57 | 57 | { |
| 58 | 58 | $context = []; |
| 59 | 59 | $param = new RequestData($request); |
| 60 | 60 | $totalItems = $this->permissionRepository->query() |
| 61 | - ->count('id'); |
|
| 61 | + ->count('id'); |
|
| 62 | 62 | |
| 63 | 63 | $currentPage = (int) $param->get('page', 1); |
| 64 | 64 | |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | - * List entity detail |
|
| 90 | - * @param ServerRequestInterface $request |
|
| 91 | - * @return ResponseInterface |
|
| 92 | - */ |
|
| 89 | + * List entity detail |
|
| 90 | + * @param ServerRequestInterface $request |
|
| 91 | + * @return ResponseInterface |
|
| 92 | + */ |
|
| 93 | 93 | public function detail(ServerRequestInterface $request): ResponseInterface |
| 94 | 94 | { |
| 95 | 95 | $context = []; |
@@ -115,10 +115,10 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | - * Create new entity |
|
| 119 | - * @param ServerRequestInterface $request |
|
| 120 | - * @return ResponseInterface |
|
| 121 | - */ |
|
| 118 | + * Create new entity |
|
| 119 | + * @param ServerRequestInterface $request |
|
| 120 | + * @return ResponseInterface |
|
| 121 | + */ |
|
| 122 | 122 | public function create(ServerRequestInterface $request): ResponseInterface |
| 123 | 123 | { |
| 124 | 124 | $context = []; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $context['param'] = $formParam; |
| 129 | 129 | |
| 130 | 130 | $permissions = $this->permissionRepository->orderBy('code') |
| 131 | - ->all(); |
|
| 131 | + ->all(); |
|
| 132 | 132 | |
| 133 | 133 | $context['permissions'] = $permissions; |
| 134 | 134 | |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | $entityExist = $this->permissionRepository->findBy([ |
| 155 | - 'code' => $formParam->getCode(), |
|
| 156 | - ]); |
|
| 155 | + 'code' => $formParam->getCode(), |
|
| 156 | + ]); |
|
| 157 | 157 | |
| 158 | 158 | if ($entityExist !== null) { |
| 159 | 159 | $this->flash->setError($this->lang->tr('This record already exist')); |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | /** @var Permission $permission */ |
| 169 | 169 | $permission = $this->permissionRepository->create([ |
| 170 | - 'code' => $formParam->getCode(), |
|
| 171 | - 'description' => $formParam->getDescription(), |
|
| 170 | + 'code' => $formParam->getCode(), |
|
| 171 | + 'description' => $formParam->getDescription(), |
|
| 172 | 172 | ]); |
| 173 | 173 | |
| 174 | 174 | try { |
@@ -193,10 +193,10 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
| 196 | - * Update existing entity |
|
| 197 | - * @param ServerRequestInterface $request |
|
| 198 | - * @return ResponseInterface |
|
| 199 | - */ |
|
| 196 | + * Update existing entity |
|
| 197 | + * @param ServerRequestInterface $request |
|
| 198 | + * @return ResponseInterface |
|
| 199 | + */ |
|
| 200 | 200 | public function update(ServerRequestInterface $request): ResponseInterface |
| 201 | 201 | { |
| 202 | 202 | $context = []; |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $context['param'] = (new PermissionParam())->fromEntity($permission); |
| 219 | 219 | |
| 220 | 220 | $permissions = $this->permissionRepository->orderBy('code') |
| 221 | - ->all(); |
|
| 221 | + ->all(); |
|
| 222 | 222 | |
| 223 | 223 | $context['permissions'] = $permissions; |
| 224 | 224 | |
@@ -244,8 +244,8 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | $entityExist = $this->permissionRepository->findBy([ |
| 247 | - 'code' => $formParam->getCode(), |
|
| 248 | - ]); |
|
| 247 | + 'code' => $formParam->getCode(), |
|
| 248 | + ]); |
|
| 249 | 249 | |
| 250 | 250 | if ($entityExist !== null && $entityExist->id !== $id) { |
| 251 | 251 | $this->flash->setError($this->lang->tr('This record already exist')); |
@@ -282,10 +282,10 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /** |
| 285 | - * Delete the entity |
|
| 286 | - * @param ServerRequestInterface $request |
|
| 287 | - * @return ResponseInterface |
|
| 288 | - */ |
|
| 285 | + * Delete the entity |
|
| 286 | + * @param ServerRequestInterface $request |
|
| 287 | + * @return ResponseInterface |
|
| 288 | + */ |
|
| 289 | 289 | public function delete(ServerRequestInterface $request): ResponseInterface |
| 290 | 290 | { |
| 291 | 291 | $id = (int) $request->getAttribute('id'); |
@@ -33,18 +33,18 @@ discard block |
||
| 33 | 33 | class UserAction |
| 34 | 34 | { |
| 35 | 35 | /** |
| 36 | - * Create new instance |
|
| 37 | - * @param Lang $lang |
|
| 38 | - * @param Pagination $pagination |
|
| 39 | - * @param Template $template |
|
| 40 | - * @param Flash $flash |
|
| 41 | - * @param RouteHelper $routeHelper |
|
| 42 | - * @param LoggerInterface $logger |
|
| 43 | - * @param RoleRepository $roleRepository |
|
| 44 | - * @param StatusList $statusList |
|
| 45 | - * @param HashInterface $hash |
|
| 46 | - * @param UserRepository $userRepository |
|
| 47 | - */ |
|
| 36 | + * Create new instance |
|
| 37 | + * @param Lang $lang |
|
| 38 | + * @param Pagination $pagination |
|
| 39 | + * @param Template $template |
|
| 40 | + * @param Flash $flash |
|
| 41 | + * @param RouteHelper $routeHelper |
|
| 42 | + * @param LoggerInterface $logger |
|
| 43 | + * @param RoleRepository $roleRepository |
|
| 44 | + * @param StatusList $statusList |
|
| 45 | + * @param HashInterface $hash |
|
| 46 | + * @param UserRepository $userRepository |
|
| 47 | + */ |
|
| 48 | 48 | public function __construct( |
| 49 | 49 | protected Lang $lang, |
| 50 | 50 | protected Pagination $pagination, |
@@ -60,16 +60,16 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | - * List all entities |
|
| 64 | - * @param ServerRequestInterface $request |
|
| 65 | - * @return ResponseInterface |
|
| 66 | - */ |
|
| 63 | + * List all entities |
|
| 64 | + * @param ServerRequestInterface $request |
|
| 65 | + * @return ResponseInterface |
|
| 66 | + */ |
|
| 67 | 67 | public function index(ServerRequestInterface $request): ResponseInterface |
| 68 | 68 | { |
| 69 | 69 | $context = []; |
| 70 | 70 | $param = new RequestData($request); |
| 71 | 71 | $totalItems = $this->userRepository->query() |
| 72 | - ->count('id'); |
|
| 72 | + ->count('id'); |
|
| 73 | 73 | |
| 74 | 74 | $currentPage = (int) $param->get('page', 1); |
| 75 | 75 | |
@@ -99,10 +99,10 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | - * List entity detail |
|
| 103 | - * @param ServerRequestInterface $request |
|
| 104 | - * @return ResponseInterface |
|
| 105 | - */ |
|
| 102 | + * List entity detail |
|
| 103 | + * @param ServerRequestInterface $request |
|
| 104 | + * @return ResponseInterface |
|
| 105 | + */ |
|
| 106 | 106 | public function detail(ServerRequestInterface $request): ResponseInterface |
| 107 | 107 | { |
| 108 | 108 | $context = []; |
@@ -129,10 +129,10 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | - * Create new entity |
|
| 133 | - * @param ServerRequestInterface $request |
|
| 134 | - * @return ResponseInterface |
|
| 135 | - */ |
|
| 132 | + * Create new entity |
|
| 133 | + * @param ServerRequestInterface $request |
|
| 134 | + * @return ResponseInterface |
|
| 135 | + */ |
|
| 136 | 136 | public function create(ServerRequestInterface $request): ResponseInterface |
| 137 | 137 | { |
| 138 | 138 | $context = []; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $formParam = new UserParam($param->posts()); |
| 142 | 142 | $context['param'] = $formParam; |
| 143 | 143 | $context['roles'] = $this->roleRepository->orderBy('name') |
| 144 | - ->all(); |
|
| 144 | + ->all(); |
|
| 145 | 145 | |
| 146 | 146 | $context['user_status'] = $this->statusList->getUserStatus(); |
| 147 | 147 | |
@@ -166,8 +166,8 @@ discard block |
||
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | $usernameExist = $this->userRepository->findBy([ |
| 169 | - 'username' => $formParam->getUsername(), |
|
| 170 | - ]); |
|
| 169 | + 'username' => $formParam->getUsername(), |
|
| 170 | + ]); |
|
| 171 | 171 | |
| 172 | 172 | if ($usernameExist !== null) { |
| 173 | 173 | $this->flash->setError($this->lang->tr('This username already exist')); |
@@ -180,8 +180,8 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | $emailExist = $this->userRepository->findBy([ |
| 183 | - 'email' => $formParam->getEmail(), |
|
| 184 | - ]); |
|
| 183 | + 'email' => $formParam->getEmail(), |
|
| 184 | + ]); |
|
| 185 | 185 | |
| 186 | 186 | if ($emailExist !== null) { |
| 187 | 187 | $this->flash->setError($this->lang->tr('This email already exist')); |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | /** @var User $user */ |
| 199 | 199 | $user = $this->userRepository->create([ |
| 200 | - 'username' => $formParam->getUsername(), |
|
| 200 | + 'username' => $formParam->getUsername(), |
|
| 201 | 201 | 'lastname' => Str::upper($formParam->getLastname()), |
| 202 | 202 | 'firstname' => Str::ucfirst($formParam->getFirstname()), |
| 203 | 203 | 'email' => $formParam->getEmail(), |
@@ -234,10 +234,10 @@ discard block |
||
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
| 237 | - * Update existing entity |
|
| 238 | - * @param ServerRequestInterface $request |
|
| 239 | - * @return ResponseInterface |
|
| 240 | - */ |
|
| 237 | + * Update existing entity |
|
| 238 | + * @param ServerRequestInterface $request |
|
| 239 | + * @return ResponseInterface |
|
| 240 | + */ |
|
| 241 | 241 | public function update(ServerRequestInterface $request): ResponseInterface |
| 242 | 242 | { |
| 243 | 243 | $context = []; |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $context['param']->setRoles($currentRolesId); |
| 262 | 262 | |
| 263 | 263 | $context['roles'] = $this->roleRepository->orderBy('name') |
| 264 | - ->all(); |
|
| 264 | + ->all(); |
|
| 265 | 265 | |
| 266 | 266 | $context['user_status'] = $this->statusList->getUserStatus(); |
| 267 | 267 | |
@@ -287,8 +287,8 @@ discard block |
||
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | $usernameExist = $this->userRepository->findBy([ |
| 290 | - 'username' => $formParam->getUsername(), |
|
| 291 | - ]); |
|
| 290 | + 'username' => $formParam->getUsername(), |
|
| 291 | + ]); |
|
| 292 | 292 | |
| 293 | 293 | if ($usernameExist !== null && $usernameExist->id !== $id) { |
| 294 | 294 | $this->flash->setError($this->lang->tr('This username already exist')); |
@@ -301,8 +301,8 @@ discard block |
||
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | $emailExist = $this->userRepository->findBy([ |
| 304 | - 'email' => $formParam->getEmail(), |
|
| 305 | - ]); |
|
| 304 | + 'email' => $formParam->getEmail(), |
|
| 305 | + ]); |
|
| 306 | 306 | |
| 307 | 307 | if ($emailExist !== null && $emailExist->id !== $id) { |
| 308 | 308 | $this->flash->setError($this->lang->tr('This email already exist')); |
@@ -363,10 +363,10 @@ discard block |
||
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | /** |
| 366 | - * Delete the entity |
|
| 367 | - * @param ServerRequestInterface $request |
|
| 368 | - * @return ResponseInterface |
|
| 369 | - */ |
|
| 366 | + * Delete the entity |
|
| 367 | + * @param ServerRequestInterface $request |
|
| 368 | + * @return ResponseInterface |
|
| 369 | + */ |
|
| 370 | 370 | public function delete(ServerRequestInterface $request): ResponseInterface |
| 371 | 371 | { |
| 372 | 372 | $id = (int) $request->getAttribute('id'); |
@@ -30,17 +30,17 @@ discard block |
||
| 30 | 30 | class UserProfileAction |
| 31 | 31 | { |
| 32 | 32 | /** |
| 33 | - * Create new instance |
|
| 34 | - * @param Lang $lang |
|
| 35 | - * @param AuthenticationInterface $authentication |
|
| 36 | - * @param Template $template |
|
| 37 | - * @param Flash $flash |
|
| 38 | - * @param RouteHelper $routeHelper |
|
| 39 | - * @param LoggerInterface $logger |
|
| 40 | - * @param StatusList $statusList |
|
| 41 | - * @param HashInterface $hash |
|
| 42 | - * @param UserRepository $userRepository |
|
| 43 | - */ |
|
| 33 | + * Create new instance |
|
| 34 | + * @param Lang $lang |
|
| 35 | + * @param AuthenticationInterface $authentication |
|
| 36 | + * @param Template $template |
|
| 37 | + * @param Flash $flash |
|
| 38 | + * @param RouteHelper $routeHelper |
|
| 39 | + * @param LoggerInterface $logger |
|
| 40 | + * @param StatusList $statusList |
|
| 41 | + * @param HashInterface $hash |
|
| 42 | + * @param UserRepository $userRepository |
|
| 43 | + */ |
|
| 44 | 44 | public function __construct( |
| 45 | 45 | protected Lang $lang, |
| 46 | 46 | protected AuthenticationInterface $authentication, |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | - * User profile |
|
| 59 | - * @param ServerRequestInterface $request |
|
| 60 | - * @return ResponseInterface |
|
| 61 | - */ |
|
| 58 | + * User profile |
|
| 59 | + * @param ServerRequestInterface $request |
|
| 60 | + * @return ResponseInterface |
|
| 61 | + */ |
|
| 62 | 62 | public function detail(ServerRequestInterface $request): ResponseInterface |
| 63 | 63 | { |
| 64 | 64 | $context = []; |
@@ -88,10 +88,10 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | - * Update user profile |
|
| 92 | - * @param ServerRequestInterface $request |
|
| 93 | - * @return ResponseInterface |
|
| 94 | - */ |
|
| 91 | + * Update user profile |
|
| 92 | + * @param ServerRequestInterface $request |
|
| 93 | + * @return ResponseInterface |
|
| 94 | + */ |
|
| 95 | 95 | public function update(ServerRequestInterface $request): ResponseInterface |
| 96 | 96 | { |
| 97 | 97 | $context = []; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $user = $this->userRepository->find($id); |
| 104 | 104 | |
| 105 | 105 | if ($user === null) { |
| 106 | - $this->authentication->logout(); |
|
| 106 | + $this->authentication->logout(); |
|
| 107 | 107 | |
| 108 | 108 | $this->flash->setError($this->lang->tr('This record doesn\'t exist')); |
| 109 | 109 | |
@@ -138,8 +138,8 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | $usernameExist = $this->userRepository->findBy([ |
| 141 | - 'username' => $formParam->getUsername(), |
|
| 142 | - ]); |
|
| 141 | + 'username' => $formParam->getUsername(), |
|
| 142 | + ]); |
|
| 143 | 143 | |
| 144 | 144 | if ($usernameExist !== null && $usernameExist->id !== $id) { |
| 145 | 145 | $this->flash->setError($this->lang->tr('This username already exist')); |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | $emailExist = $this->userRepository->findBy([ |
| 155 | - 'email' => $formParam->getEmail(), |
|
| 156 | - ]); |
|
| 155 | + 'email' => $formParam->getEmail(), |
|
| 156 | + ]); |
|
| 157 | 157 | |
| 158 | 158 | if ($emailExist !== null && $emailExist->id !== $id) { |
| 159 | 159 | $this->flash->setError($this->lang->tr('This email already exist')); |
@@ -29,16 +29,16 @@ discard block |
||
| 29 | 29 | class ProductAction |
| 30 | 30 | { |
| 31 | 31 | /** |
| 32 | - * Create new instance |
|
| 33 | - * @param Lang $lang |
|
| 34 | - * @param Pagination $pagination |
|
| 35 | - * @param Template $template |
|
| 36 | - * @param Flash $flash |
|
| 37 | - * @param RouteHelper $routeHelper |
|
| 38 | - * @param LoggerInterface $logger |
|
| 39 | - * @param ProductCategoryRepository $productCategoryRepository |
|
| 40 | - * @param ProductRepository $productRepository |
|
| 41 | - */ |
|
| 32 | + * Create new instance |
|
| 33 | + * @param Lang $lang |
|
| 34 | + * @param Pagination $pagination |
|
| 35 | + * @param Template $template |
|
| 36 | + * @param Flash $flash |
|
| 37 | + * @param RouteHelper $routeHelper |
|
| 38 | + * @param LoggerInterface $logger |
|
| 39 | + * @param ProductCategoryRepository $productCategoryRepository |
|
| 40 | + * @param ProductRepository $productRepository |
|
| 41 | + */ |
|
| 42 | 42 | public function __construct( |
| 43 | 43 | protected Lang $lang, |
| 44 | 44 | protected Pagination $pagination, |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | - * List all entities |
|
| 56 | - * @param ServerRequestInterface $request |
|
| 57 | - * @return ResponseInterface |
|
| 58 | - */ |
|
| 55 | + * List all entities |
|
| 56 | + * @param ServerRequestInterface $request |
|
| 57 | + * @return ResponseInterface |
|
| 58 | + */ |
|
| 59 | 59 | public function index(ServerRequestInterface $request): ResponseInterface |
| 60 | 60 | { |
| 61 | 61 | $context = []; |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $totalItems = $this->productRepository->query() |
| 77 | - ->filter($filters) |
|
| 78 | - ->count('id'); |
|
| 77 | + ->filter($filters) |
|
| 78 | + ->count('id'); |
|
| 79 | 79 | |
| 80 | 80 | $currentPage = (int) $param->get('page', 1); |
| 81 | 81 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | ->all(); |
| 95 | 95 | |
| 96 | 96 | $categories = $this->productCategoryRepository->orderBy('name') |
| 97 | - ->all(); |
|
| 97 | + ->all(); |
|
| 98 | 98 | |
| 99 | 99 | $context['categories'] = $categories; |
| 100 | 100 | |
@@ -111,10 +111,10 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
| 114 | - * List entity detail |
|
| 115 | - * @param ServerRequestInterface $request |
|
| 116 | - * @return ResponseInterface |
|
| 117 | - */ |
|
| 114 | + * List entity detail |
|
| 115 | + * @param ServerRequestInterface $request |
|
| 116 | + * @return ResponseInterface |
|
| 117 | + */ |
|
| 118 | 118 | public function detail(ServerRequestInterface $request): ResponseInterface |
| 119 | 119 | { |
| 120 | 120 | $context = []; |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
| 143 | - * Create new entity |
|
| 144 | - * @param ServerRequestInterface $request |
|
| 145 | - * @return ResponseInterface |
|
| 146 | - */ |
|
| 143 | + * Create new entity |
|
| 144 | + * @param ServerRequestInterface $request |
|
| 145 | + * @return ResponseInterface |
|
| 146 | + */ |
|
| 147 | 147 | public function create(ServerRequestInterface $request): ResponseInterface |
| 148 | 148 | { |
| 149 | 149 | $context = []; |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $context['param'] = $formParam; |
| 154 | 154 | |
| 155 | 155 | $categories = $this->productCategoryRepository->orderBy('name') |
| 156 | - ->all(); |
|
| 156 | + ->all(); |
|
| 157 | 157 | |
| 158 | 158 | $context['categories'] = $categories; |
| 159 | 159 | |
@@ -177,8 +177,8 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | $entityExist = $this->productRepository->findBy([ |
| 180 | - 'name' => $formParam->getName(), |
|
| 181 | - ]); |
|
| 180 | + 'name' => $formParam->getName(), |
|
| 181 | + ]); |
|
| 182 | 182 | |
| 183 | 183 | if ($entityExist !== null) { |
| 184 | 184 | $this->flash->setError($this->lang->tr('This record already exist')); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | /** @var Product $product */ |
| 194 | 194 | $product = $this->productRepository->create([ |
| 195 | - 'name' => $formParam->getName(), |
|
| 195 | + 'name' => $formParam->getName(), |
|
| 196 | 196 | 'description' => $formParam->getDescription(), |
| 197 | 197 | 'price' => $formParam->getPrice(), |
| 198 | 198 | 'quantity' => $formParam->getQuantity(), |
@@ -221,10 +221,10 @@ discard block |
||
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /** |
| 224 | - * Update existing entity |
|
| 225 | - * @param ServerRequestInterface $request |
|
| 226 | - * @return ResponseInterface |
|
| 227 | - */ |
|
| 224 | + * Update existing entity |
|
| 225 | + * @param ServerRequestInterface $request |
|
| 226 | + * @return ResponseInterface |
|
| 227 | + */ |
|
| 228 | 228 | public function update(ServerRequestInterface $request): ResponseInterface |
| 229 | 229 | { |
| 230 | 230 | $context = []; |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $context['param'] = (new ProductParam())->fromEntity($product); |
| 247 | 247 | |
| 248 | 248 | $categories = $this->productCategoryRepository->orderBy('name') |
| 249 | - ->all(); |
|
| 249 | + ->all(); |
|
| 250 | 250 | |
| 251 | 251 | $context['categories'] = $categories; |
| 252 | 252 | |
@@ -272,8 +272,8 @@ discard block |
||
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | $entityExist = $this->productRepository->findBy([ |
| 275 | - 'name' => $formParam->getName(), |
|
| 276 | - ]); |
|
| 275 | + 'name' => $formParam->getName(), |
|
| 276 | + ]); |
|
| 277 | 277 | |
| 278 | 278 | if ($entityExist !== null && $entityExist->id !== $id) { |
| 279 | 279 | $this->flash->setError($this->lang->tr('This record already exist')); |
@@ -313,10 +313,10 @@ discard block |
||
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
| 316 | - * Delete the entity |
|
| 317 | - * @param ServerRequestInterface $request |
|
| 318 | - * @return ResponseInterface |
|
| 319 | - */ |
|
| 316 | + * Delete the entity |
|
| 317 | + * @param ServerRequestInterface $request |
|
| 318 | + * @return ResponseInterface |
|
| 319 | + */ |
|
| 320 | 320 | public function delete(ServerRequestInterface $request): ResponseInterface |
| 321 | 321 | { |
| 322 | 322 | $id = (int) $request->getAttribute('id'); |
@@ -28,15 +28,15 @@ discard block |
||
| 28 | 28 | class CategoryAction |
| 29 | 29 | { |
| 30 | 30 | /** |
| 31 | - * Create new instance |
|
| 32 | - * @param Lang $lang |
|
| 33 | - * @param Pagination $pagination |
|
| 34 | - * @param Template $template |
|
| 35 | - * @param Flash $flash |
|
| 36 | - * @param RouteHelper $routeHelper |
|
| 37 | - * @param LoggerInterface $logger |
|
| 38 | - * @param ProductCategoryRepository $productCategoryRepository |
|
| 39 | - */ |
|
| 31 | + * Create new instance |
|
| 32 | + * @param Lang $lang |
|
| 33 | + * @param Pagination $pagination |
|
| 34 | + * @param Template $template |
|
| 35 | + * @param Flash $flash |
|
| 36 | + * @param RouteHelper $routeHelper |
|
| 37 | + * @param LoggerInterface $logger |
|
| 38 | + * @param ProductCategoryRepository $productCategoryRepository |
|
| 39 | + */ |
|
| 40 | 40 | public function __construct( |
| 41 | 41 | protected Lang $lang, |
| 42 | 42 | protected Pagination $pagination, |
@@ -49,16 +49,16 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * List all entities |
|
| 53 | - * @param ServerRequestInterface $request |
|
| 54 | - * @return ResponseInterface |
|
| 55 | - */ |
|
| 52 | + * List all entities |
|
| 53 | + * @param ServerRequestInterface $request |
|
| 54 | + * @return ResponseInterface |
|
| 55 | + */ |
|
| 56 | 56 | public function index(ServerRequestInterface $request): ResponseInterface |
| 57 | 57 | { |
| 58 | 58 | $context = []; |
| 59 | 59 | $param = new RequestData($request); |
| 60 | 60 | $totalItems = $this->productCategoryRepository->query() |
| 61 | - ->count('id'); |
|
| 61 | + ->count('id'); |
|
| 62 | 62 | |
| 63 | 63 | $currentPage = (int) $param->get('page', 1); |
| 64 | 64 | |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | - * List entity detail |
|
| 90 | - * @param ServerRequestInterface $request |
|
| 91 | - * @return ResponseInterface |
|
| 92 | - */ |
|
| 89 | + * List entity detail |
|
| 90 | + * @param ServerRequestInterface $request |
|
| 91 | + * @return ResponseInterface |
|
| 92 | + */ |
|
| 93 | 93 | public function detail(ServerRequestInterface $request): ResponseInterface |
| 94 | 94 | { |
| 95 | 95 | $context = []; |
@@ -115,10 +115,10 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | - * Create new entity |
|
| 119 | - * @param ServerRequestInterface $request |
|
| 120 | - * @return ResponseInterface |
|
| 121 | - */ |
|
| 118 | + * Create new entity |
|
| 119 | + * @param ServerRequestInterface $request |
|
| 120 | + * @return ResponseInterface |
|
| 121 | + */ |
|
| 122 | 122 | public function create(ServerRequestInterface $request): ResponseInterface |
| 123 | 123 | { |
| 124 | 124 | $context = []; |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | $entityExist = $this->productCategoryRepository->findBy([ |
| 150 | - 'name' => $formParam->getName(), |
|
| 151 | - ]); |
|
| 150 | + 'name' => $formParam->getName(), |
|
| 151 | + ]); |
|
| 152 | 152 | |
| 153 | 153 | if ($entityExist !== null) { |
| 154 | 154 | $this->flash->setError($this->lang->tr('This record already exist')); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | /** @var ProductCategory $category */ |
| 164 | 164 | $category = $this->productCategoryRepository->create([ |
| 165 | - 'name' => $formParam->getName(), |
|
| 165 | + 'name' => $formParam->getName(), |
|
| 166 | 166 | 'description' => $formParam->getDescription(), |
| 167 | 167 | ]); |
| 168 | 168 | |
@@ -188,10 +188,10 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** |
| 191 | - * Update existing entity |
|
| 192 | - * @param ServerRequestInterface $request |
|
| 193 | - * @return ResponseInterface |
|
| 194 | - */ |
|
| 191 | + * Update existing entity |
|
| 192 | + * @param ServerRequestInterface $request |
|
| 193 | + * @return ResponseInterface |
|
| 194 | + */ |
|
| 195 | 195 | public function update(ServerRequestInterface $request): ResponseInterface |
| 196 | 196 | { |
| 197 | 197 | $context = []; |
@@ -233,8 +233,8 @@ discard block |
||
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | $entityExist = $this->productCategoryRepository->findBy([ |
| 236 | - 'name' => $formParam->getName(), |
|
| 237 | - ]); |
|
| 236 | + 'name' => $formParam->getName(), |
|
| 237 | + ]); |
|
| 238 | 238 | |
| 239 | 239 | if ($entityExist !== null && $entityExist->id !== $id) { |
| 240 | 240 | $this->flash->setError($this->lang->tr('This record already exist')); |
@@ -271,10 +271,10 @@ discard block |
||
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | /** |
| 274 | - * Delete the entity |
|
| 275 | - * @param ServerRequestInterface $request |
|
| 276 | - * @return ResponseInterface |
|
| 277 | - */ |
|
| 274 | + * Delete the entity |
|
| 275 | + * @param ServerRequestInterface $request |
|
| 276 | + * @return ResponseInterface |
|
| 277 | + */ |
|
| 278 | 278 | public function delete(ServerRequestInterface $request): ResponseInterface |
| 279 | 279 | { |
| 280 | 280 | $id = (int) $request->getAttribute('id'); |