【问题标题】:Propel, Add alias to select statement推进,为选择语句添加别名
【发布时间】:2012-06-21 09:06:28
【问题描述】:

我正在使用带有 symfony 2.1 的 propel master-dev。 有可能写这样的东西吗?否则如何为 select 语句添加别名。

    $products = ProdottinewQuery::create()
      ->leftJoinWith('Prodotticolori')
      ->leftJoinWith('Alberocategorie')
      ->leftJoinWith('Brand')
      ->leftJoinWith('Prodottimateriali')
      ->leftJoinWith('Prodottigroffatura')
      ->select(array('id',
                     'codice',
                     'nomeEng',
                     'Alberocategorie.nomeeng' => 'category',
                     'Prodotticolori.coloreeng' => 'color',
                     'Brand.brand' => 'brand',
                     'Prodottimateriali.materialeeng' => 'material',
                     'Prodottigroffatura.groffaturaeng' => 'groffage'))
      ->orderById()
      ->limit($howmany)
      ->find();

【问题讨论】:

    标签: php propel symfony-2.1


    【解决方案1】:

    已解决:

        $products = ProdottinewQuery::create()
          ->leftJoinWith('Prodotticolori')
          ->leftJoinWith('Alberocategorie')
          ->leftJoinWith('Brand')
          ->leftJoinWith('Prodottimateriali')
          ->leftJoinWith('Prodottigroffatura')
          ->select(array('id',
                         'codice',
                         'nomeEng'))
          ->withColumn('Alberocategorie.nomeeng', 'category')  
          ->withColumn('Prodotticolori.coloreeng', 'color')
          ->withColumn('Brand.brand', 'brand')
          ->withColumn('Prodottimateriali.materialeeng', 'material')
          ->withColumn('Prodottigroffatura.groffaturaeng', 'groffage')
          ->orderById()
          ->limit($howmany)
          ->find();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-03-22
      • 1970-01-01
      • 2020-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多