Change brand and size parameters to brand_id and size_id. #201
This commit is contained in:
parent
620a750465
commit
24a0e5a2d1
2 changed files with 10 additions and 10 deletions
|
|
@ -77,12 +77,12 @@ class TestCommand extends Command
|
|||
|
||||
// add battery
|
||||
$sku = 'WZMB31QT-CPP00-S';
|
||||
$brand = '4';
|
||||
$size = '1';
|
||||
$brand_id = '4';
|
||||
$size_id = '1';
|
||||
$params = [
|
||||
'sku' => $sku,
|
||||
'brand' => $brand,
|
||||
'size' => $size,
|
||||
'brand_id' => $brand_id,
|
||||
'size_id' => $size_id,
|
||||
];
|
||||
$api->post('/capi/batteries', $params);
|
||||
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ class BatteryController extends APIController
|
|||
// required parameters
|
||||
$params = [
|
||||
'sku',
|
||||
'brand',
|
||||
'size',
|
||||
'brand_id',
|
||||
'size_id',
|
||||
];
|
||||
|
||||
$msg = $this->checkRequiredParameters($req, $params);
|
||||
|
|
@ -91,8 +91,8 @@ class BatteryController extends APIController
|
|||
return new APIResponse(false, $msg);
|
||||
|
||||
$sku = $req->request->get('sku');
|
||||
$brand = $req->request->get('brand');
|
||||
$size = $req->request->get('size');
|
||||
$brand_id = $req->request->get('brand_id');
|
||||
$size_id = $req->request->get('size_id');
|
||||
|
||||
// check if sku already exists
|
||||
$batt = $em->getRepository(SAPBattery::class)->find($sku);
|
||||
|
|
@ -100,12 +100,12 @@ class BatteryController extends APIController
|
|||
return new APIResponse(false, 'Battery SKU already exists.');
|
||||
|
||||
// check if brand exists
|
||||
$batt_brand = $em->getRepository(SAPBatteryBrand::class)->find($brand);
|
||||
$batt_brand = $em->getRepository(SAPBatteryBrand::class)->find($brand_id);
|
||||
if ($batt_brand == null)
|
||||
return new APIResponse(false, 'Invalid brand.');
|
||||
|
||||
// check if size exists
|
||||
$batt_size = $em->getRepository(SAPBatterySize::class)->find($size);
|
||||
$batt_size = $em->getRepository(SAPBatterySize::class)->find($size_id);
|
||||
if ($batt_size == null)
|
||||
return new APIResponse(false, 'Invalid size.');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue