Php 在select语句中添加别名
我正在将propel master dev与symfony 2.1一起使用。 有可能写这样的东西吗?否则,如何向select语句添加别名Php 在select语句中添加别名,php,propel,symfony-2.1,Php,Propel,Symfony 2.1,我正在将propel master dev与symfony 2.1一起使用。 有可能写这样的东西吗?否则,如何向select语句添加别名 $products = ProdottinewQuery::create() ->leftJoinWith('Prodotticolori') ->leftJoinWith('Alberocategorie') ->leftJoinWith('Brand') ->leftJoinW
$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();
决议:
$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();