1
0
mirror of synced 2025-01-18 22:41:43 +03:00

support for unique columns in multikey tables

This commit is contained in:
runa 2007-06-04 18:47:26 +00:00
parent 38437492d2
commit a41cd2bb01

View File

@ -42,7 +42,12 @@ class Doctrine_Validator_Unique
public function validate(Doctrine_Record $record, $key, $value, $args)
{
$table = $record->getTable();
$sql = 'SELECT ' . $table->getIdentifier() . ' FROM ' . $table->getTableName() . ' WHERE ' . $key . ' = ?';
$pks = $table->getIdentifier();
if ( is_array($pks) ) {
$pks = join(',',$pks);
}
$sql = 'SELECT ' . $pks . ' FROM ' . $table->getTableName() . ' WHERE ' . $key . ' = ?';
$values = array();
$values[] = $value;