Re: Custom Validation Method in Behaviour

2008-11-07 Thread si-mon

Sorry.. I have got the correct solution:
The problem was with the parameter list of the behaviour method.
The correct format is:

function checkRelatedItem(&$model = null, $data, $foreign_key=null,
$related_model=null, $model_name=null)
{ .. }

i.e. I have added the first parameter as &$model = null.


On Nov 7, 2:32 am, si-mon <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> In my application, I have used the custom validation rule as:
>
> 'rule'=>array('checkRelatedItem','office_id','Office','Employee')
>
> and I have defined the function checkRelatedItem in a behaviour:
>
> function checkRelatedItem($data, $foreign_key=null,
> $related_model=null, $model_name=null) {
> echo $foreign_key;
> echo $related_model;
> echo $model_name;
>
> }
>
> But, the parameters of the function are not passing correctly.
>
> Please help me to solve this problem...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Custom Validation Method in Behaviour

2008-11-06 Thread si-mon

Hi all,

In my application, I have used the custom validation rule as:

'rule'=>array('checkRelatedItem','office_id','Office','Employee')

and I have defined the function checkRelatedItem in a behaviour:

function checkRelatedItem($data, $foreign_key=null,
$related_model=null, $model_name=null) {
echo $foreign_key;
echo $related_model;
echo $model_name;
}

But, the parameters of the function are not passing correctly.

Please help me to solve this problem...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---