Sure, it does sound a little convoluted... I'll try again!

for example:

class ExampleController extends AppController {
  var $actsAs = array('SomeComponent');
}

class SomeComponent extends Component {
  public function someAction() {

  }
}

What I want to be able to do is have the url
(controller=>ExampleController, action=SomeAction) result in the
SomeAction member of the component being called as an action. Of
course I could just write: function someAction() { return $this-
>SomeComponent->someAction()); } lots of times in my controller (for
all the actions), but it would be nice not to have to do all that
typing.

Essentially I view it working the same way as ModelBehaviours, the way
you can call $model->functionInBehaviour() directly. The change would
probably have to go in the dispatcher though, rather than the
controller.

Right now I am achieving the effect through the rather in-elegant, and
potentially dangerous:
class SomeComponent extends Component {
  function startup(&$controller) {
    $action = $controller->params['action'];
    if method_exists($this,$action) {
      $this->$action();
    }
  }
  function someAction() {
    ... do some stuff which results in a $this->controller->redirect,
renderAction or such like, ie completely fulfills an action ...
  }
}

It's certainly an enhancement, but I think the design might need some
discussion before it's worth submitting/rejecting as an enhancement.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to