JOIN

  class GoodsPeer extends BaseGoodsPeer
  {
     public static function doSelectDetail($criteria, $con = null) {
         parent::addSelectColumns($criteria);
         $criteria->addSelectColumn(CategoryPeer::CATEGORY_NAME);
         return GoodsPeer::populateDetailObjects(GoodsPeer::doSelectStmt($criteria, $con));
     }
  
     public static function populateDetailObjects($stmt) {
         $results = array();
  
         $class = GoodsPeer::getOMClass();
         $class = Propel::importClass($class);
         $classDetail = $class."Detail";
         while($row = $stmt->fetch(PDO::FETCH_NUM)) {
             $obj = new $classDetail();
             $obj->hydrate($row);
         }              
                         
         return $obj;
     }
 
  }
 $c = new Criteria();
 $c->add(GoodsPeer::ID, 123);
 $c->addJoin(GoodsPeer::CATEGORY_ID, CategoryPeer::ID, Criteria::INNER_JOIN);
                                    
 $rows = GoodsPeer::doSelectDetail($c, $this->con);

参考


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS