Commit a41cd2bb authored by runa's avatar runa

support for unique columns in multikey tables

parent 38437492
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment