Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZF3 Compatibility #642

Closed
Rockstar04 opened this issue Jun 28, 2016 · 54 comments
Closed

ZF3 Compatibility #642

Rockstar04 opened this issue Jun 28, 2016 · 54 comments

Comments

@Rockstar04
Copy link
Contributor

ZF3 has officially been released: https://framework.zend.com/blog/2016-06-28-zend-framework-3.html

@oprokidnev
Copy link

+1

@pdrosos
Copy link

pdrosos commented Jun 30, 2016

+1

1 similar comment
@telkins
Copy link

telkins commented Jun 30, 2016

+1

@Rockstar04
Copy link
Contributor Author

Actually it looks like 1.4.4 has been updated for the new ServiceManger already. It was issues with how my code was overriding ZfcUser classes that caused an issue I assumed was ZF3 incompatibility.

@telkins
Copy link

telkins commented Jun 30, 2016

@Rockstar04 I could be wrong, but I don't think it's that simple. ZfcUser requires ZfcBase which in turn requires zend-mvc ~2.1. If one tries to use ZfcUser with zend-mvc 3, then there's a conflict.

Now...there may be a way around this that I don't know about. If so, please enlighten me. Otherwise, if my understanding is correct, then ZfcBase's dependencies need to be updated or, better yet, ZfcBase should be dropped as a dependency for ZfcUser....which is the goal of #560.

If I'm right, please re-open. If not, please help me to use zend-mvc 3 correctly. I'd appreciate it. :-)

@Rockstar04 Rockstar04 reopened this Jun 30, 2016
@Rockstar04
Copy link
Contributor Author

Rockstar04 commented Jun 30, 2016

@telkins You are right, I was looking over quite a few of my projects dependencies yesterday and forgot about the tie to zend-mvc, I was just looking over the version history here and got ahead of myself.

@telkins
Copy link

telkins commented Jun 30, 2016

@Rockstar04 👍 Nice...! The dependencies can be a bit tricky, sometimes. I'm hoping that #560 can be resolved quickly since there doesn't appear to be any need for it any longer. Once that's done, I think the task becomes relatively straightforward. Let's hope so, anyway. :-)

@stijnhau
Copy link

stijnhau commented Jul 3, 2016

I'm doing some changes on the dev-master to add support for ZF3.
Also because there are chaanges in the factoryInterface and so on ;)

@Danielss89
Copy link
Member

@stijnhau Can you do it in 1.x, without BC breaks?

@stijnhau
Copy link

stijnhau commented Jul 4, 2016

@Danielss89 I will first do the dev-master because that is the one i'm using ;) and i don't have that much time.
Did already a small change and should have no BC break(Not yet commited)

@telkins
Copy link

telkins commented Jul 4, 2016

@stijnhau Any ETA...?

@stijnhau
Copy link

stijnhau commented Jul 4, 2016

@telkins I hope to finish dev-master this weekend

@stijnhau
Copy link

stijnhau commented Jul 4, 2016

https://github.com/stijnhau/ZfcUser/tree/ZF3

For people who wants to help also ;)
Or people that are intrested to see the changes.
Have updated the composer.json file
Dropped zfcBase dependency(only dropped nothing changed yet will see where it's used and do changes then).
Working on factories now. This way i'm working they also should be compatible with ZF2 and ZF3

@svycka
Copy link
Contributor

svycka commented Jul 8, 2016

@stijnhau create a PR from that

@stijnhau
Copy link

stijnhau commented Jul 8, 2016

@svycka
The moment i'm ready i will
Todo:

  • Databse to tablegateway
  • Events

@svycka
Copy link
Contributor

svycka commented Jul 8, 2016

you can do changes on PR so why ou cant create it now and do your changes later? it would be easier to see what you changed and comment what you did wrong, suggest what to fix and so on

@stijnhau
Copy link

stijnhau commented Jul 8, 2016

@svycka
I'm more a fan of creating the PR when it's ready so that way ou cna see the working result cause now it to uch a work in progress.

@oprokidnev
Copy link

@stijnhau I think that saving both SMv2 and SMv3 compaibility is not a good idea.

@stijnhau
Copy link

stijnhau commented Jul 8, 2016

@oprokidnev
Why do u think it's a bad idea?

@telkins
Copy link

telkins commented Jul 9, 2016

My 2 cents: I think both SMv2 and SMv3 should be supported. Otherwise, there need to be separate versions of ZfcUser.

While I would prefer to move ahead and stay at the cutting edge, having only support for the latest and greatest, there are some situations where it's not possible/realistic. The ZF developers have provided a way to support both versions simultaneously for a reason. It's because not everyone will be willing/able to move forward.

Also, keep in mind that a single dependency can potentially be a single factor in forcing one forward or keeping one back. I've gone through the work of upgrading to SMv3 and found that a single dependency, like ZfcUser, will hold me back. Of course, if ZfcUser now suddenly supports only SMv3, then those who are not ready to move ahead will be forced to...or they will miss out on further ZfcUser fixes/features.

So, supporting both is a good step forward...at least if there's only going to be one version. If it's a matter of how to move ahead with 1.x, then support for both is the only realistic/pragmatic solution. If it's a matter of having a ZfcUser solution that only supports SMv3, then I think that means an introduction of a 2.x version is necessary, since it will no longer be backward compatible.

My vote for now: bridge the gap and support both. It's a relatively simple fix and any disadvantages (that I can think of) are negligible.

@stijnhau
Copy link

stijnhau commented Jul 9, 2016

Yes telkins that is the reason i wan't to have SMv2 and SMv3 support.

@stijnhau
Copy link

stijnhau commented Jul 9, 2016

Havin major issue at the moment with refactoring.
Event's is still undecided how i'm going to handle those so put in comment for now.
https://github.com/zendframework/zend-mvc-plugin-flashmessenger
Check that repo it is the slashmessanger but it support onnly zend-mvc 3.x branch.
Any idea how we can work around that?

@adamlundrigan
Copy link
Contributor

adamlundrigan commented Jul 9, 2016

@stijnhau you could probably add a Composer script that checks the installed version of zend-mvc and if it is ^3.0 then also install the necessary zend-mvc-plugin-* repositories.

My 2 cents though would be to explictly declare ZfcUser 1.x as being for ZF2 and do a ZfcUser 2.x release for ZF3. Last time I was actively using ZfcUser I advocated for v2.x to be split, putting MVC integration into a separate package and so allowing easier reuse of the ZfcUser "core" in other contexts (eg: Apigility). That would also help in this case: MVC 2.x and MVC 3.x support could be provided through separate packages, if necessary.

@adamlundrigan
Copy link
Contributor

After more thought, In the interim I suggest this: we release a ZfcUser v2.x that supports only zend-mvc 3.x but is otherwise identical to ZfcUser 1.x, then relabel the current master branch as ZfcUser 3.x (since it already has BC-breaking changes committed, IIRC). It does, however, mean we are now concurrently maintaining 3 branches, so maybe lock <3.0 to only backporting of critical bug fixes?

(that "we" seems to be just Daniel now, tbh, so of course it would be up to him if he wants to expend that maintenance effort)

@stijnhau
Copy link

stijnhau commented Jul 9, 2016

Okez you are right a change i did earlier already requires MVCv3 and php 5.6 so i've updated the composer fiole to request the new changes.
Will see that i can look for the event tomorrow and can do a testrun and update the readme

@Danielss89
Copy link
Member

I will do a reply tomorrow evening on what i decide with branches and BC.

@oprokidnev
Copy link

oprokidnev commented Jul 10, 2016

@stijnhau You've just mention why (zend-mvc-* repos).
The second point is that this module requires massive refactoring:

  • drop zfc-base deps
  • remove service config from Module.php (bad caching)
  • stop using shared manager in zf3 (bad performance, static lazy event listener injection should be used instead)
    and so on.

Saving BC would make module development harder. Module is stable enought for now and new version of module should only be compatible with latest dev options

@stijnhau
Copy link

@oprokidnev
Wat is wrong with the service config like it is used in the dev master at the moment?

An update on the state of the change:
Having issues at the moment withthe autenticate function that gives a fatal somewhere(do not have the code or testexample next to me)

@Danielss89
Copy link
Member

I decided to go the following way:
ZfcUser 1.x = Supports ZF2.0 - Only receives security updates
ZfcUser 2.x = Copy of current 1.x, but with refactors(and BC breaks) to support servicemanager 3
ZfcIser master = Future version, with many changes and BC breaks.

I have vacation next week, and will update Github accordingly. Feel free to create PR's :)

@stijnhau
Copy link

I propse 1 change extra for zfcuser 2.0
Thé user_id to id

@Danielss89
Copy link
Member

@stijnhau No, that is too big a BC. I want BC breaks to be as few and small as possible.

@stijnhau
Copy link

Agreed but it will be a new major version.
So I don't see a reason to keep that faulty dB design

@Danielss89
Copy link
Member

If you have an existing app and want's to upgrade to ZF3, you want as minimal changes as possible. Changing user_id to id will require you to change a lot of your entities with an association to the user entity, and you will have to change your database also, which can be a bit difficult.

The "new" version of ZfcUser, is not meant for upgrading, but for new project, so there it is fine to do the change.

@oprokidnev
Copy link

oprokidnev commented Jul 12, 2016

@Danielss89 You can try my fork as a base. Has reached some forms to be working, but currently has no time for this. BC breaks with zf2.
https://github.com/oprokidnev/ZfcUser/tree/zf3
https://github.com/oprokidnev/ZfcBase/tree/zf3

@Danielss89
Copy link
Member

Hi All

I've finally had some more time to work on this(it required more work than i first thought). Anyway, i pushed a 2.x branch, i haven't tagged yet, as i would like your feedback and testing for this.

@stijnhau
Copy link

stijnhau commented Aug 2, 2016

@Danielss89
Can you take a look at my fork of the master for V3 support?
Cause i'm stuck somewhere
TypeError
File:
C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zf-commons\zfc-user\src\ZfcUser\Authentication\Adapter\Db.php:52
Message:
Argument 1 passed to ZfcUser\Authentication\Adapter\Db::authenticate() must be an instance of ZfcUser\Authentication\Adapter\AdapterChainEvent, instance of Zend\EventManager\Event given, called in C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zendframework\zend-eventmanager\src\EventManager.php on line 271
Stack trace:
#0 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zendframework\zend-eventmanager\src\EventManager.php(271): ZfcUser\Authentication\Adapter\Db->authenticate(Object(Zend\EventManager\Event))
#1 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zendframework\zend-eventmanager\src\EventManager.php(122): Zend\EventManager\EventManager->triggerListeners(Object(Zend\EventManager\Event))
#2 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zf-commons\zfc-user\src\ZfcUser\Authentication\Adapter\AdapterChain.php(58): Zend\EventManager\EventManager->trigger('authenticate', Object(ZfcUser\Authentication\Adapter\AdapterChainEvent), Object(Closure))
#3 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zf-commons\zfc-user\src\ZfcUser\Controller\UserController.php(164): ZfcUser\Authentication\Adapter\AdapterChain->prepareForAuthentication(Object(Zend\Http\PhpEnvironment\Request))
#4 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zendframework\zend-mvc\src\Controller\AbstractActionController.php(78): ZfcUser\Controller\UserController->authenticateAction()
#5 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zendframework\zend-eventmanager\src\EventManager.php(271): Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#6 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zendframework\zend-eventmanager\src\EventManager.php(151): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#7 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zendframework\zend-mvc\src\Controller\AbstractController.php(105): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#8 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zendframework\zend-mvc\src\Controller\Plugin\Forward.php(143): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#9 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zf-commons\zfc-user\src\ZfcUser\Controller\UserController.php(131): Zend\Mvc\Controller\Plugin\Forward->dispatch('zfcuser', Array)
#10 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zendframework\zend-mvc\src\Controller\AbstractActionController.php(78): ZfcUser\Controller\UserController->loginAction()
#11 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zendframework\zend-eventmanager\src\EventManager.php(271): Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#12 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zendframework\zend-eventmanager\src\EventManager.php(151): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#13 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zendframework\zend-mvc\src\Controller\AbstractController.php(105): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#14 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zendframework\zend-mvc\src\DispatchListener.php(119): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#15 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zendframework\zend-eventmanager\src\EventManager.php(271): Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#16 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zendframework\zend-eventmanager\src\EventManager.php(151): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#17 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\vendor\zendframework\zend-mvc\src\Application.php(332): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#18 C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\Zf2TestProject\1.0.0_12\public\index.php(40): Zend\Mvc\Application->run()
#19 {main}
And if you look at the stacktrace the correct event is passes to the listener but when the listener is triggered it somehow back the wrong one.

@adamlundrigan
Copy link
Contributor

@Danielss89 here's my feedback:

  • Composer recommends library code use ^ instead of ~ for version pinning (https://getcomposer.org/doc/articles/versions.md#caret)
  • Is there a reason to keep the EventProvider class? It's functionally identical to EventManagerAwareTrait and AFAIR was only added to maintain support for PHP 5.3
    • Same point for ProvidesEventsForm and ProvidesEventsInputFilter. We could keep the class to make things easy, but it's contents could be replaced by a use of that trait.
    • It would be nice to strip out all this legacy stuff added for ZF2 beta and early 2.0 releases (as I had worked on here and here) but I think that's best left to v3.
  • Typehint on EventInterface here and here

I haven't updated any of my projects to use ZF3 components yet (:disappointed:) so I can't actually test these changes beyond code review and running the tests.

@stijnhau
Copy link

I have doine some work for the dev master branch.
Its currently works with ZF3 but there is still some cleanup needed and the user mapper has some todo's as weel.
But it is already using tablegateway and not the db mapper like before.

@olexp
Copy link

olexp commented Sep 12, 2016

@Danielss89
@adamlundrigan

There is an issue with extending forms via event (https://github.com/ZF-Commons/ZfcUser/wiki/How-to-modify-the-form-objects-used-by-ZfcUser) in 2.x-dev.
Attaching listeners to authenticate.fail of ZfcUser\Authentication\Adapter\AdapterChain and init of ZfcUser\Form\Login failed for me. ProvidesEventsForm does not inject shared manager at all. EventProvider injects new instance of SharedEventManager that is different from one that could be get via application events in Module::onBootstrap().

@RobertTutaev
Copy link

When you're ready Zfcuser version 2?
I can not migrate to zf3!

@boscho87
Copy link

Go !
+1 !!

@phgeek
Copy link

phgeek commented Oct 21, 2016

Any news about ZF3 support?

@savez
Copy link

savez commented Oct 21, 2016

no i'm sorry

@Danielss89
Copy link
Member

There are still some problems with the PR, so i can't merge yet. Unfortunately i'm extremely busy right now, so i don't have the time to fix at this moment. Please feel free to create PR's agains mine, and help fix the bugs.

@stijnhau
Copy link

@Danielss89
Can you say wat your issues are at the moment?

@Danielss89
Copy link
Member

@stijnhau Well, i know there are some problems with the event stuff, but if you read the backlog of this issue, then it explains it better.

@Sohorev
Copy link

Sohorev commented Dec 16, 2016

Please help, I am install stijnhau/ZfcUser from git hub and when I try to install zf-commons/zfc-user-doctrine-orm from composer I have an error:

composer require zf-commons/zfc-user-doctrine-orm
Using version ^1.0 for zf-commons/zfc-user-doctrine-orm
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - zf-commons/zfc-user-doctrine-orm 1.0.1 requires doctrine/doctrine-orm-module 0.* -> satisfiable by doctrine/doctrine-orm-module[0.1.0, 0.10.0, 0.11.0, 0.2.0, 0.2.1, 0.3.0, 0.3.1, 0.4.0, 0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.5.5, 0.5.6, 0.5.7, 0.6.0, 0.7.0, 0.8.0, 0.8.0-beta1, 0.8.0-beta2, 0.8.0-beta3, 0.8.0-beta4, 0.9.0, 0.9.1, 0.9.2] but these conflict with your requirements or minimum-stability.
    - zf-commons/zfc-user-doctrine-orm 1.0.0 requires doctrine/doctrine-orm-module 0.* -> satisfiable by doctrine/doctrine-orm-module[0.1.0, 0.10.0, 0.11.0, 0.2.0, 0.2.1, 0.3.0, 0.3.1, 0.4.0, 0.5.0, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.5.5, 0.5.6, 0.5.7, 0.6.0, 0.7.0, 0.8.0, 0.8.0-beta1, 0.8.0-beta2, 0.8.0-beta3, 0.8.0-beta4, 0.9.0, 0.9.1, 0.9.2] but these conflict with your requirements or minimum-stability.
    - Installation request for zf-commons/zfc-user-doctrine-orm ^1.0 -> satisfiable by zf-commons/zfc-user-doctrine-orm[1.0.0, 1.0.1].

What me do?

@CallumBrankin
Copy link

any update on this? my module depends on this to allow my module to upgrade to zend framework 3

@RobertTutaev
Copy link

silent

@jpalmer4444
Copy link

Me too - my module depends on this, any update?

@rarog
Copy link

rarog commented Apr 17, 2017

I tested the 2 x branch and it is working good with ZF3 for me. Don't see any reason not to use it. Just use "composer require zf-commons/zfc-user 2.x-dev"

@adamlundrigan
Copy link
Contributor

@rarog AFAIK work hasn't progressed far on ZfcUser 2.x, so it's still largely the same as 1.x. When/if 2.x development picks up steam and BC breaks are introduced your code will no longer work. If you must use the 2.x branch, pin to a specific commit rather than just 2.x-dev.

@rarog
Copy link

rarog commented Apr 23, 2017

@adamlundrigan Of course, this is what I did and what I always do, if I have to rely on some instable branch.

@Danielss89
Copy link
Member

ZF3 support released in 3.x branch :)

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

No branches or pull requests