Я пытаюсь получить ответ в виде вложенного формата json
[
{
"recipe_id":"33",
"e_name":"crispy",
"e_desc":"Crispy Gingersnaps",
"calries":"500",
"steps":[
{
"step_id":"22",
"recipe_id":"33",
"step_number":3,
"instruction":'here is the instructions',
}
{
"step_id":"23",
"recipe_id":"34",
"step_number":4,
"instruction":'here is the instructions',
}
{
"step_id":"23",
"recipe_id":"35",
"step_number":5,
"instruction":'here is the instructions',
}
]
}
]
это мой код
$query = new \yii\db\Query();
$recipes = $query->select(['recipe.recipe_id','recipe.image','recipe.'.$name,'recipe.'.$small_desc,'recipe.person_count',
'recipe.calories','recipe.period','recipe.'.$desc,'recipe_step.instruction'])->from('recipe')
->where(['recipe.recipe_id' => $recipe_id])
->innerJoin("recipe_step","recipe.recipe_id=recipe_step.recipe_id");
я получаю результат, но формат json не такой, как я ожидал