Friday, March 11, 2016

[Cakephp 2.8.1] Multiple assosication to one model with habtm throws a notice

Hello Cakephp Fans,

today i receive these error:

Notice (8): Undefined index: User [CORE\Cake\Model\Datasource\DboSource.php, line 1388]

Its easy to reproduce:

Model: User belongsTo Group
Model: Permission habtm Rights (className User)
Permission habtm Owners (className User)

When i use now
$this->Permission->find('all', array('recursive' => -2));

the notice will be thrown. But only for the 2nd habtm.

The output is like:
array(
       
'Permission' => array(
               
'id' => '6',
       
),
       
'Owner' => array(
               
(int) 0 => array(
                       
'id' => '499',
                       
'PermissionOwner' => array(
                               
'id' => '6',
                               
'user_id' => '499',
                               
'permission_id' => '6'
                       
)
               
)
       
),
       
'Rights' => array(
               
(int) 0 => array(
                       
'id' => '485',
                       
'PermissionRight' => array(
                               
'id' => '18',
                               
'permission_id' => '6',
                               
'user_id' => '485',
                       
),
                       
'Group' => array()
               
),
               
(int) 1 => array(
                       
'id' => '124',
'PermissionRight'                                'id' => '19',
                               
'permission_id' => '6',
                               
'user_id' => '124',
                       
),
                       
'Group' => array()
               
)
       
)
)



Kind Regards

--
Sign up for our Newsletter for updates.
http://cakephp.org/newsletter/signup
 
We will soon be closing this Google Group. But don't worry, we have something better coming. Stay tuned for an updated from the CakePHP Team soon.
 
Like Us on FaceBook https://www.facebook.com/CakePHP
Follow us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: