Add call to get list of promos, sorted by name in ascending order. #229
This commit is contained in:
parent
47589de2db
commit
ad5cc72dbd
1 changed files with 22 additions and 0 deletions
|
|
@ -717,6 +717,28 @@ class APIController extends Controller
|
||||||
if ($res->isError())
|
if ($res->isError())
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
|
|
||||||
|
// get promos
|
||||||
|
$promos = $em->getRepository(Promo::class)->findBy([], ['name' => 'asc']);
|
||||||
|
|
||||||
|
error_log("mogol " . count($promos));
|
||||||
|
|
||||||
|
$promo_list = [];
|
||||||
|
foreach($promos as $promo)
|
||||||
|
{
|
||||||
|
$promo_list[] = [
|
||||||
|
'id' => $promo->getID(),
|
||||||
|
'name' => $promo->getName(),
|
||||||
|
'code' => $promo->getCode(),
|
||||||
|
'discount_rate' => $promo->getDiscountRate(),
|
||||||
|
'discount_apply'=> $promo->getDiscountApply(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'promos' => $promo_list
|
||||||
|
];
|
||||||
|
$res->setData($data);
|
||||||
|
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue