-- Tim Nagel <[EMAIL PROTECTED]> wrote
(on Tuesday, 09 December 2008, 11:19 AM +1100):
> I am trying to create a basic content serving controller where user created
> data is served using the action name as a name specified by the user.
> (Overridden __call in the controller).
>  
> I have hit a bit of a snag in that it looks like Zend is normalising
> (lowercasing and doing funky stuff with camelcase and underscores) action
> values which isnt ideal for my situation. Is there a way to turn this 
> behaviour
> off? Or even a poke in the right direction of where its occuring? I havent had
> a chance to delve into the router/front controller/dispatcher but my quick 
> look
> didnt uncover anything.

The ViewRenderer action helper includes a Zend_Filter_Inflector instance
that performs this normalisation. You can modify the rules used by
pushing your own inflector into the ViewRenderer, or modifying the one
present.

    $viewRenderer = 
Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
    $inflector = $viewRenderer->getInflector();

As an example, the current rules are setup using the following:

    $inflector->setRules(array(
        ':module'     => array('Word_CamelCaseToDash', 'StringToLower'),
        ':controller' => array('Word_CamelCaseToDash', new 
Zend_Filter_Word_UnderscoreToSeparator('/'), 'StringToLower', new 
Zend_Filter_PregReplace('/\./', '-')),
        ':action'     => array('Word_CamelCaseToDash', new 
Zend_Filter_PregReplace('#[^a-z0-9' . preg_quote('/', '#') . ']+#i', '-'), 
'StringToLower'),
    ));

For more information on the inflector, see:
    
    http://framework.zend.com/manual/en/zend.filter.inflector.html

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to