/**
  * @param integer $id
  * @return Query
  */
 public static function getWeightQuery($id)
 {
     $prodWeightSql = self::getProductsWeightQuery('`d`.`id`')->createCommand()->sql;
     $recWeightSql = self::getRecipesWeightQuery('`d`.`id`')->createCommand()->sql;
     $portWeightSql = self::getPortionsWeightQuery('`d`.`id`')->createCommand()->sql;
     return (new Query())->select("COALESCE(({$prodWeightSql}), 0) + COALESCE(({$recWeightSql}), 0) + COALESCE(({$portWeightSql}), 0) AS `weight`")->from(Diary::tableName() . ' `d`')->where(['`d`.`id`' => $id]);
 }