Closed prolic closed 5 years ago
Actually, the AbstractHydrator
of v2.7.0
has BC breaks to v2.6.0
as it doesn't implement zendframework/zend-stdlib
interfaces like StrategyEnabledInterface
, e.g.
Therefore, any code that depends on those interfaces (e.g. by typehinting them in method definitions), cannot upgrade to v2.7.0
.
Bad example but this might show the problem pretty clear:
<?php
class MyHydratorWhichAlwaysHadStrategyEnabledInterfaceFromStdlib extends \Zend\Stdlib\Hydrator\AbstractHydrator
{
// Implementation
}
class Service
{
private $hydrator;
public function __construct(MyHydratorWhichAlwaysHadStrategyEnabledInterfaceFromStdlib $hydrator)
{
// Yes we could use interface typehinting but however
$this->hydrator = $hydrator;
}
public function doSomething()
{
// do some fancy stuff
// Attach some custom strategies
$this->attachCustomStrategies($this->hydrator);
}
private function attachCustomStrategies(\Zend\Stdlib\Hydrator\StrategyEnabledInterface $hydrator)
{
// Work with that interface
}
}
Well now, the argumentation could be "Why wont you just check the interface before using the Method. Okay, I could do that, but anyways, the code wont getting executed at all then.
Proper way would be to migrate our code to the new interfaces introduced with zendframework/zend-hydrator
but actually this could have side-effects in our code which contains more than a few lines.
However, any reasons why the interfaces are not implemented in zendframework/zend-stdlib
AbstractHydrator
? Just wondering, this would've been the best way to ensure BC.
Dont wont to start a discussion, just a little hint to understand these changes for myself.
Related issues have all have been closed, and this one should be closed too, because it now is obsolete.
See for reference: https://github.com/phpro/zf-doctrine-hydration-module/issues/20
also related: https://github.com/zfcampus/zf-apigility-doctrine/issues/234