php - cakephp validation rules not firing -


given following controller:

class userscontroller extends appcontroller { public function finduser() { ... $this->user->finduser($this->request->query['u']); ... } } 

and following model:

class user extends appmodel { public $validate = array( 'username' => array( 'rule' => array('minlength', '8'), 'message' => 'username must @ least 8 characters' ) ); public function finduser($username) { return $this->find('all', array( 'conditions' => array('username' => $username), )); } } 


if example type in url: http://example.com/users/finduser?u=a validator not triggered. why?

validators insert or update data, not query data.


Comments

Popular posts from this blog

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -