/** * Validates a single attribute. * * @param CModel $object the data object being validated * @param string $attribute the name of the attribute to be validated. */ protected function validateAttribute($object, $attribute) { if (!$object->isAttributeDirty($attribute)) { return; } if ($this->model === null) { //currently unsupported return; } if ($this->message === null) { $this->message = '{attribute} can not be edited because it is already in use'; } if ($this->foreignKey === null) { $this->foreignKey = $object->tableName() . '_id'; } if ($this->validateContainedInModel($object->id)) { $this->addError($object, $attribute, $this->message); } }