Skip to content

Commit 073c0d7

Browse files
chore: variables name change
1 parent 13c07dd commit 073c0d7

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

src/Model/AbstractModel.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,41 +38,41 @@ public function findById($id) {
3838

3939
/** Delete Data by Id */
4040
public function delete(array $args) {
41-
$data = $this->repository->findBy($args)[0] ?? null;
41+
$row = $this->repository->findBy($args)[0] ?? null;
4242

43-
if ($data):
44-
$this->entityManager->remove($data);
43+
if ($row):
44+
$this->entityManager->remove($row);
4545
$this->entityManager->flush();
4646

47-
return $data;
47+
return $row;
4848
endif;
4949
}
5050

5151
/** Update Data by Id */
5252
public function update(array $data, array $args) {
53-
$item = $this->repository->findBy($args)[0] ?? null;
53+
$row = $this->repository->findBy($args)[0] ?? null;
5454

55-
if ($item):
55+
if ($row):
5656
foreach ($data as $key => $value)
57-
$item->__set($key, $value);
57+
$row->__set($key, $value);
5858

59-
$this->entityManager->merge($item);
59+
$this->entityManager->merge($row);
6060
$this->entityManager->flush();
6161

62-
return $data;
62+
return $row;
6363
endif;
6464
}
6565

6666
/** Insert Data */
67-
public function insert(array $args) {
68-
$data = new $this->entity;
67+
public function insert(array $data) {
68+
$row = new $this->entity;
6969

70-
foreach ($args as $key => $value)
71-
$data->__set($key, $value);
70+
foreach ($data as $key => $value)
71+
$row->__set($key, $value);
7272

73-
$this->entityManager->persist($data);
73+
$this->entityManager->persist($row);
7474
$this->entityManager->flush();
7575

76-
return $data;
76+
return $row;
7777
}
7878
}

src/api/category/router.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
class Router {
99
public function __invoke(RouteCollectorProxy $router) {
1010
$router->get('/', [Controller::class, "findAll"]);
11+
$router->get('/{id:[0-9]+}/', [Controller::class, "findByColumn"]);
1112
$router->get('/{slug:[a-z0-9-]+}/', [Controller::class, "findByColumn"]);
1213
}
1314
}

src/api/user/router.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
class Router {
1010
public function __invoke(RouteCollectorProxy $router) {
1111
$router->get('/', [Controller::class, "findAll"]);
12+
$router->get('/{id:[0-9]+}/', [Controller::class, "findByColumn"]);
1213
$router->get('/{username:[a-z0-9-]+}/', [Controller::class, "findByColumn"]);
1314

1415
// Category Route

0 commit comments

Comments
 (0)