2012-06-19 17 views
5

Ich verwende Propeller Master-Dev mit Symfony 2.1. Ist es möglich, so etwas zu schreiben? Wie kann ich der select-Anweisung einen Alias ​​hinzufügen?Propel, Alias ​​zur Auswahl der Anweisung hinzufügen

$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(); 

Antwort

9

Entschlossen:

$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(); 
Verwandte Themen