Question

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();
Was it helpful?

Solution

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();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top