get_cell.php 524 B

12345678910111213141516171819202122
  1. <?php /** Created by Anton on 15.02.2020. */
  2. use yii\db\Query;
  3. use app\models\entity\Tmc;
  4. use app\models\entity\Storage;
  5. require '../yiiInit.php';
  6. $inventoryNum = (int)Yii::$app->request->post('num');
  7. $query = new Query();
  8. $query->select('ts.title')
  9. ->from(Tmc::tableName() . ' tt')
  10. ->leftJoin(Storage::tableName() . ' ts', 'tt.storage = ts.id')
  11. ->where(['inventory_num' => $inventoryNum])
  12. ;
  13. $result = $query->one();
  14. if ($result) {
  15. echo $result['title'];
  16. } else {
  17. echo '404';
  18. }