To follow up my question, I found a work around by putting the
following into my Post controller
public function beforeFilter()
{
if(!$this->Post->Behaviors->enabled('Tree'))
{
$this->Post->Behaviors->attach('Tree', array('left' => 'left',
'right' => 'right'));
$this->Post->Behaviors->enable('Tree');
}
}
On Jul 5, 11:06 pm, matt <[email protected]> wrote:
> Hi there,
>
> Lovingcakephp!
>
> I'm fiddling around with dynamic routes inCakePHPand was getting on
> fine until I realised that using App:import will allow me to use a
> model within bootstrap.php but breaks any attached behaviors that
> model may have for use in a controller.
>
> If it helps, bootstrap code here:http://bin.cakephp.org/view/1875864372
>
> and routes.php code here:http://bin.cakephp.org/view/1017686056
>
> My question is - can I use a model in bootstrap.php to get an array of
> urls for use in routes.php that will not break the models behaviors in
> subsequent controller actions? Is there another way to do this with
> some sort of callback method where I can set my page slugs for
> routes.php before it is loaded? I know this could be a performance
> hit if say we had lots of pages, but this would be perfect for a small
> project I have on the go.
>
> For further info:
>
> I check enabled behaviors in my controller with and without the code
> in routes.php and bootstrap.php using $this->Post->Behaviors->enabled
> ('Tree'). With the code commented out the behavior is there.
>
> Any help would be greatly appreciated!
>
> Thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---