tags:

views:

22

answers:

2

I'm running into a problem with GroupsController::build_acl()- http://book.cakephp.org/view/647/An-Automated-tool-for-creating-ACOs

It's taken me a while to track down the bug and now I've found it I'm not sure how to work around it.

Symptoms:

Not all methods for NodesController (defined by me) are returned.

Probable reason:

build_acl() imports a 3rd party plugin that also has a NodesController and a subsequent App::import() doesn't overwrite it.

I'm about to try two runs of the build, one with the plugin code commented out, but a more durable solution would be preferred!

I need a way to either drop an imported controller or force a re-import while remaining in scope.

+1  A: 

you can not do what you want to do, think about straight php for a while. once you have used include('some/file.php'); how do you un-import it? you cant.

now the reason why you cant overwrite it is once again down to php. what happens if you run

<?php
include('some/file.php');
include('some/file.php');
?>

you will get errors about the class being defined already.

Cake is stopping this from happening, so the only (and correct way) is to not have 2 controllers with the same name. you can name them what ever you like and use the router to map to nice urls.

dogmatic69
Of course I know you can't include a class definition twice - that, as I inferred, is why I'm getting the problem. My question was about redefining a class and I see now that it's probably only possible using the PECL extension. WRT your final sentence, I know.
Leo
A: 

Turns out the plugin was redundant and not called anywhere in the application and would have broken it if it was as a class redefinition error would have ensued. After removal of the files everything worked okay.

Leo