public function getConstraint($type, Model $Model, Model $LinkModel, $association, $assocData, $association2 = null)
{
$assocData += array('external' => false);
if (empty($assocData['foreignKey'])) {
return array();
}
switch ($type) {
case 'hasOne':
if ($assocData['external']) {
return array("{$association}.{$assocData['foreignKey']}" => '{$__cakeID__$}');
} else {
return array("{$association}.{$assocData['foreignKey']}" => $this->identifier("{$Model->alias}.{$Model->primaryKey}"));
}
case 'belongsTo':
if ($assocData['external']) {
return array("{$association}.{$LinkModel->primaryKey}" => '{$__cakeForeignKey__$}');
} else {
return array("{$Model->alias}.{$assocData['foreignKey']}" => $this->identifier("{$association}.{$LinkModel->primaryKey}"));
}
case 'hasMany':
return array("{$association}.{$assocData['foreignKey']}" => array('{$__cakeID__$}'));
case 'hasAndBelongsToMany':
return array(array("{$association}.{$assocData['foreignKey']}" => '{$__cakeID__$}'), array("{$association}.{$assocData['associationForeignKey']}" => $this->identifier("{$association2}.{$LinkModel->primaryKey}")));
}
return array();
}