class User extends EMongoDocument
{
public $password;
public $login;
public $first_name;
public $last_name;
public $email;
public $registerDate;
/**
* This method have to be defined in every Model
* @return string MongoDB collection name, witch will be used to store documents of this model
*/
public function getCollectionName()
{
return 'users';
}
// We can define rules for fields, just like in normal CModel/CActiveRecord classes
public function rules()
{
return array(
array('login, email, password', 'required'),
array('password', 'validatePwd'),
array('email', 'email'),
);
}
// the same with attribute names
public function attributeNames()
{
return array(
'email' => 'E-Mail Address',
);
}
/*
*/
public function validatePwd($attribute,$params)
{
}
/**
* This method have to be defined in every model, like with normal CActiveRecord
*/
public static function model($className=__CLASS__)
{
return parent::model($className);
}
}