Example #1
0
 private function queryForMultitermAssoc(DB $aDB, Association $aMultitermAssoc, array &$arrDataSheet, $nRowIdx)
 {
     $aToPrototype = $aMultitermAssoc->toPrototype();
     $aFromPrototype = $aMultitermAssoc->fromPrototype();
     // 根据上一轮查询设置条件
     if ($aMultitermAssoc->isType(Association::hasMany)) {
         $aRestraction = $this->makeResrictionForAsscotion($arrDataSheet[$nRowIdx], $aFromPrototype->path(), $aMultitermAssoc->fromKeys(), $aToPrototype->sqlTableAlias(), $aMultitermAssoc->toKeys());
     } else {
         if ($aMultitermAssoc->isType(Association::hasAndBelongsToMany)) {
             $aRestraction = $this->makeResrictionForAsscotion($arrDataSheet[$nRowIdx], $aFromPrototype->path(), $aMultitermAssoc->fromKeys(), $aMultitermAssoc->bridgeSqlTableAlias(), $aMultitermAssoc->toBridgeKeys());
         } else {
             throw new ORMException("what's this?");
         }
     }
     // 新建的一个记录表
     $sheet =& Model::dataSheet($arrDataSheet, $nRowIdx, $aToPrototype->name(), true);
     $this->execute($aToPrototype, $sheet, $aRestraction, array($aToPrototype->limitLength(), $aToPrototype->limitFrom()), $aDB);
 }