On Thu, Mar 17, 2011 at 11:50 PM, thom <[email protected]> wrote:
>>
>> Oh, my bad. I found it already in the manual. Sorry.
>>
>
> Back again. I'm in trouble.
> I still dont make it. May someone guide me?
>
> My Controller
> ====================
> class ArosAcosController extends AppController {
>
> var $name = 'aros_acos';
>
> function index() {
> $this->ArosAcos->recursive = -1;
> $this->set('aros_acos', $this->ArosAcos->find('all'));
> }
> }
> ===================
>
> MyModel
> ===================
> <?php
> class ArosAcos extends AppModel {
> var $name = 'ArosAcos';
> $options['joins'] = array(
> array('table' => 'aros_acos',
> 'alias' => 'ArosAcos',
> 'type' => 'INNER',
> 'conditions' => array(
> 'ArosAcos.acos_id = acos.id',
> )
> ));
> }
> ?>
> ===================
>
>
> It gives me error :
> Call to undefined method stdClass::find() in
> D:\_\www\bread\app\controllers\aros_acos_controller.php on line 8
>
When I did this I didn't bother modelizing ArosAcos. This is from my
SectionsController. Each Group has different rights for each Section.
/* fetch the permissions for this group
*/
$perms = $this->Acl->Aco->find(
'all',
array(
'fields' => array('Aco.foreign_key'),
'conditions' => array(
'Aco.model' => 'Section',
'Aco.id = Permission.aco_id'
),
'recursive' => -1,
'joins' => array(
array(
'table' => 'aros',
'alias' => 'Aro',
'type' => 'INNER',
'conditions'=> array(
'Aro.model' => 'Group',
"Aro.foreign_key = ${group_id}"
)
),
array(
'table' => 'aros_acos',
'alias' => 'Permission',
'type' => 'INNER',
'conditions'=> array(
'Permission.aro_id = Aro.id',
'Permission._read >= 0'
)
)
)
)
);
$section_ids = Set::extract($perms, '{n}.Aco.foreign_key');
What I was doing was generating the Section navigation based on the
User's Group, then caching the output.
This is from a site that's still running on 1.2.x.
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php