u're right. now everything works :)
thank you very much
On 20 Nov, 22:31, ORCC <[EMAIL PROTECTED]> wrote:
> > <?php
> > class AppModel extends Model {
> > function beforeValidate() {
> > foreach ($this->validate as $field) {
> > foreach ($field as $rule) {
> > $rule["last"] = true;
>
> It seems that your error comes from a misunderstanding of the foreach
> constructor in PHP.
>
> The foreach iteration creates a _copy_ of each element of the array
> (the value returned by the "each" function) when iterates, hence the
> code block inside the foreach works with the copy of the array element
> instead of the actual array value.
>
> Try using references, as is explained in the PHP Manual
> foreach ($this->validate as &$field) {
> foreach ($field as &$rule) {
>
> }
>
> }
>
> And study the
> documentation:http://www.php.net/foreachhttp://php.net/manual/en/function.each.php
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---