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
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
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
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
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
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