Closed adamlundrigan closed 9 years ago
They already do! 2.6.0 depends on stdlib 2.7, which keeps all existing classes and interfaces, and has then extend the zend-hydrator equivalents. I've even tested extensively with Apigility to ensure that they fulfill the liskov substitution principle.
It sounds almost like stdlib want updated properly; can you verify the version of that library? On Sep 22, 2015 7:21 PM, "Adam Lundrigan" notifications@github.com wrote:
I happened to do a "composer update" on one of my projects very soon after Zend\Form 2.6.0 was released, and because of my version constraint (~2.5) it was installed...and then my form broke with this error:
Argument 1 passed to Zend\Form\Fieldset::setHydrator() must implement interface Zend\Hydrator\HydratorInterface, instance of **\UserQueryHydrator given
Since my custom hydrator implemented the Zend\Stdlib\Hydrator\HydratorInterface directly instead of inheriting from AbstractHydrator I could no longer use my custom hydrator in forms.
The fix was simple (replace references to "Stdlib\Hydrator" with "Hydrator") but it's still a break. IMO the better way to fix it would be to update the interfaces in Zend\Stdlib\Hydrator to extend the new ones from the Zend\Hydrator namespace. If that's an acceptable solution I can send a PR
— Reply to this email directly or view it on GitHub https://github.com/zendframework/zend-stdlib/issues/25.
I have zend-stdlib 2.7.1 and in it Zend\Stdlib\Hydrator\HydratorInterface
doesn't directly extend Zend\Hydrator\HydratorInterface
and so isn't accepted by the Form::setHydrator
typehint. It extends Zend\Hydrator\HydrationInterface
(through deprecated Zend\Stdlib\Hydrator\HydrationInterface
) and Zend\Hydrator\ExtractionInterface
(through deprecated Zend\Stdlib\Extractor\ExtractionInterface
).
The plural "...interfaces in Zend\Stdlib\Hydrator..." in my original post wasn't warranted...it's only the HydratorInterface that's affected. The Hydration and Extraction interfaces are OK.
Oof, can't believe I missed that one! Yes, please do a PR, and I'll get it merged and cut a release as soon as I can.
Thanks, Adam! On Sep 22, 2015 8:32 PM, "Adam Lundrigan" notifications@github.com wrote:
I have zend-stdlib 2.7.1 and in it Zend\Stdlib\Hydrator\HydratorInterface https://github.com/zendframework/zend-stdlib/blob/master/src/Hydrator/HydratorInterface.php doesn't directly extend Zend\Hydrator\HydratorInterface and so isn't accepted by the Form::setHydrator typehint https://github.com/zendframework/zend-form/blob/master/src/Form.php#L14. It extends Zend\Hydrator\HydrationInterface (through deprecated Zend\Stdlib\Hydrator\HydrationInterface) and Zend\Hydrator\ExtractionInterface (through deprecated Zend\Stdlib\Extractor\ExtractionInterface).
The plural "...interfaces n Zend\Stdlib\Hydrator.." in my original post wasn't warranted...it's only the HydratorInterface that's affected. The Hydration and Extraction interfaces are OK.
— Reply to this email directly or view it on GitHub https://github.com/zendframework/zend-stdlib/issues/25#issuecomment-142468747 .
It was a tricky one, took some headscratching and a few runs through the inheritance chain to spot it.
PR to fix is in #26
Closed with #26.
I happened to do a "composer update" on one of my projects very soon after Zend\Form 2.6.0 was released, and because of my version constraint (~2.5) it was installed...and then my form broke with this error:
Since my custom hydrator implemented the Zend\Stdlib\Hydrator\HydratorInterface directly instead of inheriting from AbstractHydrator I could no longer use my custom hydrator in forms.
The fix was simple (replace references to "Stdlib\Hydrator" with "Hydrator") but it's still a break. IMO the better way to fix it would be to update the interfaces in Zend\Stdlib\Hydrator to extend the new ones from the Zend\Hydrator namespace. If that's an acceptable solution I can send a PR