mirror of
https://github.com/yiisoft/yii.git
synced 2026-03-03 06:44:07 +01:00
CUniqueValidator and CExistValidator have been updated to use table alias while creating db query condition (fixes bug #114)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
Version 1.1.11 work in progress
|
||||
-------------------------------
|
||||
- Bug #114: CUniqueValidator and CExistValidator now respect table alias while creating db query condition (klimov-paul)
|
||||
- Bug #145: CGettextMoFile now can parse strings with no context (eagleoneraptor)
|
||||
- Bug #164: CEmailValidator.checkPort now checks the port 25 of listed MX servers (DaSourcerer)
|
||||
- Bug #193: Changed datetime column type for postgresql from 'time' to 'timestamp' (cebe)
|
||||
|
||||
@@ -75,7 +75,7 @@ class CExistValidator extends CValidator
|
||||
throw new CException(Yii::t('yii','Table "{table}" does not have a column named "{column}".',
|
||||
array('{column}'=>$attributeName,'{table}'=>$table->name)));
|
||||
|
||||
$criteria=array('condition'=>$column->rawName.'=:vp','params'=>array(':vp'=>$value));
|
||||
$criteria=array('condition'=>$finder->getTableAlias(true).'.'.$column->rawName.'=:vp','params'=>array(':vp'=>$value));
|
||||
if($this->criteria!==array())
|
||||
{
|
||||
$criteria=new CDbCriteria($criteria);
|
||||
|
||||
@@ -92,7 +92,7 @@ class CUniqueValidator extends CValidator
|
||||
|
||||
$columnName=$column->rawName;
|
||||
$criteria=new CDbCriteria(array(
|
||||
'condition'=>$this->caseSensitive ? "$columnName=:value" : "LOWER($columnName)=LOWER(:value)",
|
||||
'condition'=>$this->caseSensitive ? $finder->getTableAlias(true).".{$columnName}=:value" : "LOWER(".$finder->getTableAlias(true).".{$columnName})=LOWER(:value)",
|
||||
'params'=>array(':value'=>$value),
|
||||
));
|
||||
if($this->criteria!==array())
|
||||
|
||||
Reference in New Issue
Block a user