RE: Validate Question

2013-05-10 Thread Advantage+
Right. My bad. Good looking out! Thanks guys J From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of André Luis Sent: Friday, May 10, 2013 8:53 AM To: cake-php@googlegroups.com Subject: Re: Validate Question It´s not a rule model have no access to components

Re: Validate Question

2013-05-10 Thread André Luis
It´s not a rule model have no access to components, you can get it on any method inside any model using AuthComponent::user('user_id'), that´s why some components have some static method, an example of this is when you create a user and need to hash the password before it saves... on model User

Re: Validate Question

2013-05-10 Thread Chetan Varshney
Create a variable in model for e.g. in User model var $auth; and set this variable value from controller's beforeFilter function $this->User->auth = $this->Session->read('Auth'); now you can access user id in User model this way $userId =0; if(!empty($this->auth['User']['id'])) { $userId =$t

RE: Validate Question

2010-01-07 Thread Dave
Behalf Of Miles J Sent: January-07-10 2:24 PM To: CakePHP Subject: Re: Validate Question You will have to set the validation rule during runtime in your model/ controller, like so: $this->Model->validate['field']['inList'] = array('rule' => array ('inList&#

Re: Validate Question

2010-01-07 Thread Miles J
You will have to set the validation rule during runtime in your model/ controller, like so: $this->Model->validate['field']['inList'] = array('rule' => array ('inList', $myListVariable)); On Jan 7, 2:06 am, John Andersen wrote: > Hi Dave, > > Is your rule made in accordance with CakePHP custom v

Re: Validate Question

2010-01-07 Thread John Andersen
Hi Dave, Is your rule made in accordance with CakePHP custom validation rules? If yes, then I don't see a better solution. See http://book.cakephp.org/view/150/Custom-Validation-Rules#Adding-your-own-Validation-Methods-152 for the custom validation rules. Enjoy, John On Jan 7, 7:48 am, "Dav