Invalid argument using Auth Component

View: New views
2 Messages — Rating Filter:   Alert me  

Invalid argument using Auth Component

by damanlovett :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I'm using the tutorial CakePHP Auth Component - Users, Groups &
Permissions Revisited

The error I'm getting is

Warning (2): Invalid argument supplied for foreach() [APP/
app_controller.php, line 98]



The code for the line error is

                $thisPermissions = $thisPermissions['Permission'];
                foreach($thisPermissions as $thisPermission){
                    $permissions[]=$thisPermission['name'];
                }

Which seems like no information is being passed to the loop.

Can any one help me figure out why information isn't being passed to
the loop?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@...
To unsubscribe from this group, send email to cake-php+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Invalid argument using Auth Component

by John Andersen-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Check that the variable $thisPermissions contain an array and that it
is not empty!
pr($thisPermissions)

Maybe you don't need the line:
$thisPermissions = $thisPermissions['Permission'];

Enjoy,
   John

On Nov 6, 12:03 am, damanlovett <ed...@...> wrote:

> I'm using the tutorial CakePHP Auth Component - Users, Groups &
> Permissions Revisited
>
> The error I'm getting is
>
> Warning (2): Invalid argument supplied for foreach() [APP/
> app_controller.php, line 98]
>
> The code for the line error is
>
>                 $thisPermissions = $thisPermissions['Permission'];
>                 foreach($thisPermissions as $thisPermission){
>                     $permissions[]=$thisPermission['name'];
>                 }
>
> Which seems like no information is being passed to the loop.
>
> Can any one help me figure out why information isn't being passed to
> the loop?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@...
To unsubscribe from this group, send email to cake-php+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---