Fix invalid edit/delete paths on crud lists

This commit is contained in:
Ramon Gutierrez 2018-01-09 02:03:48 +08:00
parent a43cb4a0db
commit 0b5862e4d4
2 changed files with 5 additions and 14 deletions

View file

@ -82,12 +82,6 @@ class RoleController extends BaseController
->getQuery() ->getQuery()
->getResult(Query::HYDRATE_ARRAY); ->getResult(Query::HYDRATE_ARRAY);
// response
return $this->json([
'meta' => $meta,
'data' => $rows
]);
// add crud urls // add crud urls
foreach ($rows as $index => $row) { foreach ($rows as $index => $row) {
$rows[$index]['update_url'] = $this->generateUrl('role_update', ['id' => $row['id']]); $rows[$index]['update_url'] = $this->generateUrl('role_update', ['id' => $row['id']]);

View file

@ -35,7 +35,7 @@ class UserController extends BaseController
$qb = $this->getDoctrine() $qb = $this->getDoctrine()
->getRepository(User::class) ->getRepository(User::class)
->createQueryBuilder('q'); ->createQueryBuilder('q');
// count total records // count total records
$total = $qb->select('COUNT(q)') $total = $qb->select('COUNT(q)')
->getQuery() ->getQuery()
@ -87,12 +87,6 @@ class UserController extends BaseController
->getQuery() ->getQuery()
->getResult(Query::HYDRATE_ARRAY); ->getResult(Query::HYDRATE_ARRAY);
// response
return $this->json([
'meta' => $meta,
'data' => $rows
]);
// add crud urls // add crud urls
foreach ($rows as $index => $row) { foreach ($rows as $index => $row) {
$rows[$index]['update_url'] = $this->generateUrl('user_update', ['id' => $row['id']]); $rows[$index]['update_url'] = $this->generateUrl('user_update', ['id' => $row['id']]);
@ -100,7 +94,10 @@ class UserController extends BaseController
} }
// response // response
return $this->json(['data' => $rows]); return $this->json([
'meta' => $meta,
'data' => $rows
]);
} }
public function create() public function create()