2012-06-19 23 views
5

Tôi đang sử dụng propel master-dev với symfony 2.1. Có thể viết một cái gì đó như thế không? Khác làm cách nào tôi có thể thêm bí danh vào câu lệnh chọn.Propel, Thêm bí danh để chọn câu lệnh

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

Trả lời

9

giải quyết:

$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(); 
Các vấn đề liên quan