Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Feature/compatible with mvc 3 #33

Merged

Conversation

RalfEggert
Copy link
Contributor

Make Zend\Navigation compatible with Zend\Mvc and Zend\Router

use Zend\Mvc\Router\RouteMatch;
use Zend\Mvc\Router\RouteStackInterface;
use Zend\Router\Http\RouteMatch;
use Zend\Router\Http\TreeRouteStack;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain, why you use a concrete implementation and no longer the interface?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my mistake. Fixed that. I blame it on the weather.... ;-)

@@ -10,8 +10,8 @@
namespace Zend\Navigation\Page;

use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\Router\RouteMatch;
use Zend\Mvc\Router\RouteStackInterface;
use Zend\Router\Http\RouteMatch;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change also Zend\Router\Http\RouteMatch to Zend\Router\RouteMatch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@froschdesign
Copy link
Member

@RalfEggert
Don't forget the unit tests! (See Travis)

@RalfEggert
Copy link
Contributor Author

Fixed the tests

@froschdesign
Copy link
Member

froschdesign commented Jun 9, 2016

@RalfEggert
Some more:

  • We have to check the dependency to Zend\Mvc. Maybe we can remove it and add only Zend\Router to composer.json.
  • I think, at the moment we must move Zend\Permissions from the "suggest" part to "require" in composer.json. (See Zend\Navigation\Page\AbstractPage)

@vaclavvanik
Copy link
Contributor

@RalfEggert you can look at https://github.com/zendframework/zend-view/blob/master/src/Helper/Url.php

It consumes both Zend\Mvc\Router and Zend\Router.

@froschdesign
Copy link
Member

froschdesign commented Jun 9, 2016

@vaclavvanik
Please move this problem to the Zend\View issue tracker. Thanks!

Btw. That's a good point!

@vaclavvanik
Copy link
Contributor

@froschdesign I meant @RalfEggert can look at Zend\View\Helper\Url because this helper could be used with both Zend\Mvc 2.0 and 3.0. Ralfs changes are Mvc 3.0 imho.

@froschdesign
Copy link
Member

@vaclavvanik
You are right. I thought you mean the Zend\Navigation view helpers. 😁

It consumes both Zend\Mvc\Router and Zend\Router.

This is an option for a next minor release in version 2 of Zend\Navigation. For version 3 with can remove Zend\Mvc – after a deeper look into the code base.

@RalfEggert
Copy link
Contributor Author

The only dependency to Zend\Mvc left is in https://github.com/zendframework/zend-navigation/blob/develop/src/Page/Mvc.php It uses the two constants ModuleRouteListener::ORIGINAL_CONTROLLER and ModuleRouteListener::MODULE_NAMESPACE.

Not sure about the Zend\Permissions. It is used in https://github.com/zendframework/zend-navigation/blob/develop/src/Page/AbstractPage.php and already added to the require-dev section in composer.json.

@weierophinney weierophinney added this to the 2.8.0 milestone Jun 11, 2016
@weierophinney weierophinney self-assigned this Jun 11, 2016
@weierophinney
Copy link
Member

@RalfEggert I noticed that Travis was reporting test failures for zend-mvc v2 (and servicemanager, etc.). I took the liberty of pulling locally and figuring out how to get things running. This included:

  • adding zend-router to the development requirements
  • keeping zend-mvc as a development requirement, but upping it to allow either v2 or v3.
  • updating the Mvc page type to inline the zend-mvc ModuleRouteListener constants, which removes the concrete dependency on zend-mvc. It's still needed for tests, as we have some integration tests with that class.
  • updating the suggestions to remove zend-mvc and add zend-router, and make them more descriptive of when and why you'd need them, as well as what versions are supported.
  • updating the Mvc page type tests to vary what type of router artifacts to use based on what version of zend-mvc is installed; if zend-mvc v2 is installed, it uses Zend\Mvc\Router\* classes, while for v3 it uses Zend\Router\* classes.

I've tested locally with both an updated composer.lock, as well as running --prefer-lowest, and it appears to work well! I'm opening a competing PR that incorporates your work just to ensure that tests pass against travis; if they do, I'll issue a 2.8.0 release.

Thanks for doing the heavy-lifting, @RalfEggert !

weierophinney added a commit to weierophinney/zend-navigation that referenced this pull request Jun 11, 2016
…e-with-mvc-3

Feature/compatible with mvc 3
@weierophinney weierophinney merged commit b160d6f into zendframework:develop Jun 11, 2016
weierophinney added a commit that referenced this pull request Jun 11, 2016
weierophinney added a commit that referenced this pull request Jun 11, 2016
@RalfEggert
Copy link
Contributor Author

👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants