-
Notifications
You must be signed in to change notification settings - Fork 45
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
Fix "Please be aware that ServiceLocatorAwareInterface is deprecated and will be removed in version 3.0" #73
base: master
Are you sure you want to change the base?
Conversation
$userMapper, | ||
$adminUserService, | ||
$zfcUserOptions | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cant u put this in a separate factory class?
This makes that this line is also cachable and can make it faster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yepp agreed. The only reason i did it this was was to maintain consistency with services.config.php..
Did you still want me to create separate factories?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes cause this makes caching impossible.
Just like ithere scenario you mentioned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well create factories for services.config.php as well while I am at it.
I'll try to get whatever I can do done today if not then tomorrow.
Not a fan actualy of this. |
Do you want me to merge this for now? And then you can do another ticket for the factories refactoring. |
oh crap, I completely forgot about this!! I'll create the factories tonight itself and update this PR. I'll post another comment once I finish |
@Danielss89 done |
Those factories are zf2 way. |
Don't think that is a good idea as we want to still keep supporting zf2 apps. I think you are referring to Zend\ServiceManager\Factory\FactoryInterface which has __invoke but this has only been added in version 3.x. I guess it comes down to weather we want to drop support for ServiceManager 2.x or not |
With this change we support SM2 but ot SM3 |
@rahuldroy create the __invoke method, and inside, call the other Create method. |
@Danielss89 |
So what is the final verdict then? |
Agree with @stijnhau |
Not tested or not sure about it but in the createService methiod i think u don't pass the SM but rather an other manager where you first have to call the getService Manageror Locator method on. |
@stijnhau, Can you please elaborate on it. I did a very quick test before pushing my changes and it seems to be working fine |
Can't reley elaborate on it dont know the exact details of it. /* @var ServiceLocatorInterface $serviceLocator */ |
Yes, when you are inside a factory for a controller, viewhelper, pluginhelper or formhelper, it is not a service manager being passed, but a pluginmanager. And on that you would have to do $pluginManager->getServiceLocator(); and pass that to the __invoke method. For example in the UserControllerFactory this is true. |
@Danielss89 |
@@ -15,7 +15,8 @@ | |||
"require": { | |||
"php": ">=5.3.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
::class is used and this is since php 5.5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So do you want me to remove the usage of ::class and use FQDN strings instead? or update composer.json to require PHP 5.5 instead?
I prefer the later as Zend\ServiceManager has required PHP 5.5 since 2.6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im also More a fan of going to 5.6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since 5.3 end of life has been in mid 2014, I think we should at least use 5.5 as a compromise though it's also reached it end of life already.
see: http://php.net/supported-versions.php
Havn't had any time to test it but most of it seems good. |
Any chance, that this gets merged? |
@rahuldroy
Seems like you're not setting the typehint for the first paramater. |
Fixes deprecated warnings when using newer versions of Zend Framework