Open kschroeer opened 5 years ago
Can you show us the ModuleOptions
class, please?
No problem, here's the class:
use Zend\Stdlib\AbstractOptions;
class ModuleOptions extends AbstractOptions
{
protected $hydrator = 'reflection';
protected $class = [];
public function getClass()
{
return $this->class;
}
public function setClass(array $class)
{
$this->class = $class;
return $this;
}
public function getHydrator()
{
return $this->hydrator;
}
}
And the corresponding factory:
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\Factory\FactoryInterface;
class ModuleOptionsFactory implements FactoryInterface
{
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$config = $container->get('config');
$moduleConfig = [];
if (isset($config['my-hal-hydrator-module'])) {
$moduleConfig = $config['my-hal-hydrator-module'];
}
return new ModuleOptions($moduleConfig);
}
}
This repository has been closed and moved to laminas-api-tools/api-tools-hal; a new issue has been opened at https://github.com/laminas-api-tools/api-tools-hal/issues/3.
I've a problem to use the zf-hal hydrator in combination with an abstract factory. This is my module configuration:
My abstract factory looks like this:
To test my module I created some unit tests. One of them is:
These are my test entities:
And then it could be good to know what my test module configuration looks like:
Ok, enough sourcecode. What happens now?
I run my test suite and the test above fails because of the arrays are different. That's why the first key of the result array is still 'childEntity' and not 'phpunit:test-entity' as expected.
So I think the property replacement has not take place but I don't know why.