Issues

ZF-10048: Fatal error: Call to a member function getParams() on a non-object in Zend/Navigation/Page/Mvc.php on line 133

Issue Type: Bug Created: 2010-06-24T12:28:27.000+0000 Last Updated: 2012-03-21T20:51:58.000+0000 Status: Closed Fix version(s): - 1.11.12 (22/Jun/12)

Reporter: Christoph, René Pardon (renepardon) Assignee: Frank Brückner (frosch) Tags: - Zend_Navigation

Related issues: - ZF-11372

Attachments:

Description

Zend Navigation should detect wether the page is from type mvc or uri.

You need the following configuration to reproduce this error:

<pre class="highlight">
<?xml version="1.0" encoding="UTF-8"?>
Dashboard
            /admin/index/indexdefault


<pre class="highlight">
$navConfig = new Zend_Config_Xml(APPLICATION_PATH . '/path/to/navigation.xml', 'nav');
$this->_navigation = new Zend_Navigation($navConfig);
var_dump($this->_navigation->toArray());

If you remove the comments from the type of page, the error get wings and will fly away. :) In my opinion Zend_Navigation should detect the page type automatically. Either is set then the typ is uri else it is mvc.

regards René

Comments

Posted by Kai Uwe (kaiuwe) on 2011-02-11T04:38:14.000+0000

{quote} In my opinion Zend_Navigation should detect the page type automatically. Either is set then the typ is uri else it is mvc. {quote} It does! But what do you want? In your configuration stands uri and route? Do want an Uri-Page or a MVC-Page?

Posted by Kai Uwe (kaiuwe) on 2011-04-06T15:33:05.000+0000

Extend the abstract page class and check:

<pre class="highlight">
abstract class Zend_Navigation_Page extends Zend_Navigation_Container
{
    public static function factory($options)
    {
        // …

        $hasUri = isset($options['uri']);
        $hasMvc = isset($options['action']) || isset($options['controller']) ||
                  isset($options['module']) || isset($options['route']);

        if ($hasMvc && !$hasUri) {
            require_once 'Zend/Navigation/Page/Mvc.php';
            return new Zend_Navigation_Page_Mvc($options);
        } elseif ($hasUri && !$hasMvc) {
            require_once 'Zend/Navigation/Page/Uri.php';
            return new Zend_Navigation_Page_Uri($options);
        } else {
            require_once 'Zend/Navigation/Exception.php';
            throw new Zend_Navigation_Exception(
                'Invalid argument: Unable to determine class to instantiate');
        }
    }
}

Posted by Frank Brückner (frosch) on 2012-03-21T20:51:58.000+0000

Fix is included in ZF-11372

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts