Esempio n. 1
0
 protected function makeResrictionForAsscotion(array &$arrDataRow, $sFromTableName = null, array $arrFromKeys, $sToTableName = null, array $arrToKeys)
 {
     $aRestriction = new Restriction();
     foreach ($arrFromKeys as $nIdx => $sFromKey) {
         if ($sFromTableName) {
             $sFromKey = $sFromTableName . '.' . $sFromKey;
         }
         $aRestriction->expression(array(SQL::createRawColumn($sToTableName, $arrToKeys[$nIdx]), '=', SQL::transValue($arrDataRow[$sFromKey])), true, true);
     }
     return $aRestriction;
 }
Esempio n. 2
0
 public static function buildRestriction(Prototype $aPrototype, $values = null, $keys = null)
 {
     if ($values === null) {
         return null;
     }
     $keys = $keys ? (array) $keys : $aPrototype->keys();
     if ($values instanceof Restriction) {
         return $values;
     } else {
         $aRestriction = new Restriction();
         $sSqlTableAlias = $aPrototype->sqlTableAlias();
         $values = array_values((array) $values);
         foreach ($keys as $nIdx => $sKey) {
             list($sTable, $sColumn) = SQL::splitColumn($sKey);
             $aRestriction->expression(array(SQL::createRawColumn($sTable, $sColumn), '=', SQL::transValue($values[$nIdx])), true, true);
         }
         return $aRestriction;
     }
 }