if ($select === null
) { $select =
$dependentTable->
select();
} else { $select->
setTable($dependentTable);
} $map =
$this->
_prepareReference($dependentTable,
$this->
_getTable(),
$ruleKey);
for ($i = 0;
$i <
count($map[Zend_Db_Table_Abstract::COLUMNS
]); ++
$i) { $parentColumnName =
$db->
foldCase($map[Zend_Db_Table_Abstract::REF_COLUMNS
][$i]);
$value =
$this->_data
[$parentColumnName];
// Use adapter from dependent table to ensure correct query construction
$dependentDb =
$dependentTable->
getAdapter();
$dependentColumnName =
$dependentDb->
foldCase($map[Zend_Db_Table_Abstract::COLUMNS
][$i]);
$dependentColumn =
$dependentDb->
quoteIdentifier($dependentColumnName, true
);
$dependentInfo =
$dependentTable->
info();
$type =
$dependentInfo[Zend_Db_Table_Abstract::METADATA
][$dependentColumnName]['DATA_TYPE'
];
$select->
where("
$dependentColumn = ?",
$value,
$type);
} return $dependentTable->
fetchAll($select);
}