Пример #1
0
 /**
  * @copydoc AppModel::__construct()
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     $this->validate = array('name' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter the name of your branch'))), 'address' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter the branches address'))), 'phone' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter some text for the body')), 'phone' => array('rule' => array('phone', '/\\D?(\\d{3})\\D?\\D?(\\d{3})\\D?(\\d{4})$/'), 'message' => __('The number does not seem to be valid'))), 'fax' => array('phone' => array('rule' => array('phone', '/\\D?(\\d{3})\\D?\\D?(\\d{3})\\D?(\\d{4})$/'), 'message' => __('Please enter a valid fax number'), 'allowEmpty' => true)), 'time_zone_id' => array('comparison' => array('rule' => array('comparison', '>', 0), 'message' => __('Please select your time zone'))));
 }
Пример #2
0
 /**
  * @copydoc AppModel::__construct()
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     $this->validate = array('first_name' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter the contacts first name'))), 'last_name' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter the contacts last name'))), 'phone' => array('phone' => array('rule' => array('phone', '/\\D?(\\d{3})\\D?\\D?(\\d{3})\\D?(\\d{4})$/'), 'message' => __('The number does not seem to be valid'), 'allowEmpty' => true)), 'mobile' => array('phone' => array('rule' => array('phone', '/\\D?(\\d{3})\\D?\\D?(\\d{3})\\D?(\\d{4})$/'), 'message' => __('Please enter a valid mobile number'), 'allowEmpty' => true)), 'email' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter an email address')), 'email' => array('rule' => array('email', true), 'message' => __('That email address does not seem valid'))), 'branch_id' => array('rule' => array('comparison', '>', 0), 'message' => __('Please select a branch')));
 }