-- Colin Guthrie <[EMAIL PROTECTED]> wrote
(on Thursday, 13 November 2008, 05:52 PM +0000):
> Colin Guthrie wrote:
>> I could work around the problem with a custome inflector...
>
> Actually looking again, it's not possible to work around things in this  
> way, so I really do need to fix the bug properly.
>
> I've come up with the attached patch that should work.
>
> Is this the right approach?

Could you please post this to the issue tracker? That's the proper forum
for patches.


> PS, it also removes an unused call to the getInflector()
>
> -- 
>
> Colin Guthrie
> gmane(at)colin.guthr.ie
> http://colin.guthr.ie/
>
> Day Job:
>   Tribalogic Limited [http://www.tribalogic.net/]
> Open Source:
>   Mandriva Linux Contributor [http://www.mandriva.com/]
>   PulseAudio Hacker [http://www.pulseaudio.org/]
>   Trac Hacker [http://trac.edgewall.org/]

> Index: Controller/Dispatcher/Interface.php
> ===================================================================
> --- Controller/Dispatcher/Interface.php       (revision 31183)
> +++ Controller/Dispatcher/Interface.php       (working copy)
> @@ -48,6 +48,17 @@
>      public function formatControllerName($unformatted);
>  
>      /**
> +     * Formats a string into a controller name used for view scripts.  This 
> is used
> +     * to take a raw controller name, such as one stored inside a 
> Zend_Controller_Request_Abstract
> +     * object, and reformat it to a proper name that could be used for 
> further maniplation.
> +     * e.g. to create a folder name for view scripts.
> +     *
> +     * @param string $unformatted
> +     * @return string
> +     */
> +    public function formatControllerNameForManipulation($unformatted);
> +
> +    /**
>       * Formats a string into an action name.  This is used to take a raw
>       * action name, such as one that would be packaged inside a request
>       * object, and reformat into a proper method name that would be found
> Index: Controller/Dispatcher/Abstract.php
> ===================================================================
> --- Controller/Dispatcher/Abstract.php        (revision 31183)
> +++ Controller/Dispatcher/Abstract.php        (working copy)
> @@ -101,10 +101,24 @@
>       */
>      public function formatControllerName($unformatted)
>      {
> -        return ucfirst($this->_formatName($unformatted)) . 'Controller';
> +        return $this->formatControllerNameForManipulation($unformatted) . 
> 'Controller';
>      }
>  
>      /**
> +     * Formats a string into a controller name used for view scripts.  This 
> is used
> +     * to take a raw controller name, such as one stored inside a 
> Zend_Controller_Request_Abstract
> +     * object, and reformat it to a proper name that could be used for 
> further maniplation.
> +     * e.g. to create a folder name for view scripts.
> +     *
> +     * @param string $unformatted
> +     * @return string
> +     */
> +    public function formatControllerNameForManipulation($unformatted)
> +    {
> +        return ucfirst($this->_formatName($unformatted));
> +    }
> +
> +    /**
>       * Formats a string into an action name.  This is used to take a raw
>       * action name, such as one that would be stored inside a 
> Zend_Controller_Request_Abstract
>       * object, and reformat into a proper method name that would be found
> Index: Controller/Action/Helper/ViewRenderer.php
> ===================================================================
> --- Controller/Action/Helper/ViewRenderer.php (revision 31183)
> +++ Controller/Action/Helper/ViewRenderer.php (working copy)
> @@ -632,7 +632,6 @@
>              $vars['action'] = $action;
>          }
>  
> -        $inflector = $this->getInflector();
>          if ($this->getNoController() || $this->getNeverController()) {
>              
> $this->_setInflectorTarget($this->getViewScriptPathNoControllerSpec());
>          } else {
> @@ -844,7 +843,7 @@
>          $request    = $this->getRequest();
>          $dispatcher = $this->_frontController->getDispatcher();
>          $module     = 
> $dispatcher->formatModuleName($request->getModuleName());
> -        $controller = 
> substr($dispatcher->formatControllerName($request->getControllerName()), 0, 
> -10);
> +        $controller = 
> $dispatcher->formatControllerNameForManipulation($request->getControllerName());
>          $action     = 
> $dispatcher->formatActionName($request->getActionName());
>  
>          $params     = compact('module', 'controller', 'action');


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

Reply via email to