Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Propel, Add alias to select statement

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();
like image 624
originof Avatar asked Jun 19 '12 10:06

originof


1 Answers

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();
like image 81
originof Avatar answered Dec 26 '22 12:12

originof