Пример #1
0
 public function beforeSave($options = array())
 {
     // hash password
     if (isset($this->data[$this->alias]['password'])) {
         $this->data[$this->alias]['password'] = AuthComponent::password($this->data[$this->alias]['password']);
     }
     return parent::beforeSave($options);
 }
Пример #2
0
 /**
  * Construct for validation.
  *
  * This is used to make the validation messages run through __()
  *
  * @param mixed $id
  * @param mixed $table
  * @param mixed $ds
  */
 function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     $this->validate = array('title' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter the title of your page', true))), 'category_id' => array('rule' => array('comparison', '>=', 1), 'message' => __('Please select a category', true)), 'body' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter some text for the body', true))));
 }
Пример #3
0
 /**
  * Constructor
  *
  * @param string $id ID
  * @param string $table Table
  * @param string $ds Datasource
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
 }