1234567891011121314151617181920212223242526 |
- <?php /** Created by Anton on 31.01.2020. */
- require '../yiiInit.php';
- $warehouseId = (int) Yii::$app->request->post('warehouse');
- $cellCount = (int) Yii::$app->request->post('count');
- $warehouse = \app\models\entity\Warehouse::findOne($warehouseId);
- $stack = new \app\models\entity\Stack();
- $stack->warehouse = $warehouse->id;
- $stack->number = (int) Yii::$app->request->post('number');
- $stack->title = $stack->toFormTitle();
- $stack->save();
- for($i = 1; $i <= $cellCount; $i++) {
- $storage = new \app\models\entity\Storage();
- $storage->company = $warehouse->getCompany()->id;
- $storage->warehouse = $warehouseId;
- $storage->stack = $stack->id;
- $storage->cell = $i;
- $storage->title = $storage->toFormTitle();
- $storage->tmc = 0;
- $storage->save();
- }
- Yii::$app->response->redirect(\yii\helpers\Url::to($_SERVER['HTTP_REFERER']))->send();
|