Exemplo n.º 1
0
 /**
  * Validates the attribute of the object.
  * If there is any error, the error message is added to the object.
  * @param CModel $object the object being validated
  * @param string $attribute the attribute being validated
  * @return true|false
  */
 protected function validateAttribute($object, $attribute)
 {
     if (empty($this->modelClass)) {
         $this->modelClass = get_class($object);
     }
     $tmpObj = ECassandraCF::model($this->modelClass)->getIndexedSlices($attribute, $object->{$attribute});
     // No record found
     if ($tmpObj === null) {
         return true;
     }
     // A record existed
     if (empty($this->message)) {
         $this->message = 'This value is not unique';
     }
     $this->addError($object, $attribute, $this->message);
     return false;
 }
Exemplo n.º 2
0
 /**
  * Returns the static model of the specified AR class.
  * @param string $className active record class name.
  * @return User the static model class
  */
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }