Propel, Add alias to select statement
Asked Answered
D

1

5

I'm using propel master-dev with symfony 2.1. Is possible to write something like that ? Else how can I add an alias to the select statement.

    $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();
Demob answered 19/6, 2012 at 10:24 Comment(0)
D
9

Resolved:

    $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();
Demob answered 19/6, 2012 at 10:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.