<?php

namespace app\model;
use app\model\BaseModel;

class NutritionTemplateExt extends BaseModel {
    //put your code here
    public function inquiryAllInfo($where=[], $orderBy=[]) {
        $field = ['a.train_time','a.nutrition_uuid','a.use_volume','a.use_method','b.img_path','b.name','c.name set_name'
                    ,'b.power','b.carbohydrate','b.protein','b.fat','b.sodium','b.use_weight','b.use_number','b.use_time','b.employ'];
        $rows = $this
            ->alias('a')
            ->join('nutrition b', 'b.uuid = a.nutrition_uuid', 'LEFT')
            ->join('nutrition_set c', 'b.set_uuid = c.uuid', 'LEFT')
            ->where($where)
            ->order($orderBy)
            ->field($field)
            ->select()
            ->toArray();
        foreach ($rows as &$plainWeightRow) {
            $plainWeightRow = \app\common\service\NutritionPlainFloatWeight::physicalForModel($plainWeightRow, $this);
        }
        unset($plainWeightRow);
        return $rows;
    }
}
