frontend/modules/api/controllers/DishesController.php
//custom action que permite receber os pedidos pelo userId
custom action que permite receber os pedidos pelo userId
custom action que permite receber os pedidos pelo userId
public function actionRestaurant($id){
      $connection = Yii::$app->getDb();
      $command = $connection->createCommand("
         SELECT *
         FROM dishes
         WHERE menuId =
         (
            SELECT menuId 
            FROM foodly.menus 
            WHERE date = 
            (
               SELECT MAX(date) 
               FROM 
               (
                  SELECT * 
                  FROM foodly.menus 
                  WHERE restaurantId = $id
               ) t1
            )
         );
      ");
      $recs = $command->queryAll();
      return $recs;
   }
public function actionRestaurant ( $ id ) { $ connection = Yii :: $ app -> getDb ( ) ; $ command = $ connection -> createCommand ( " 
         SELECT *
         FROM dishes
         WHERE menuId =
         (
            SELECT menuId 
            FROM foodly.menus 
            WHERE date = 
            (
               SELECT MAX(date) 
               FROM 
               (
                  SELECT * 
                  FROM foodly.menus 
                  WHERE restaurantId =  $ id 
               ) t1
            )
         );
       " ) ; $ recs = $ command -> queryAll ( ) ; return $ recs ; }
custom action que permite receber os pedidos pelo userId
custom action que permite receber os pedidos pelo userId
// $menusModel = new $this->modelClass;