Remove unused constructor parameter in SchemaProvider
neomerx opened this issue · comments
Just to point out this change should've prompted the library to jump to 0.9.x instead of remaining on 0.8.2, according to semver rules. 0.8.5, where this change went in, broke our application on update.
@luispabon I'm sorry it caused troubles for you. If your code relies on existence of that parameter you can have custom schema container as in this example. It should be pretty easy though don't hesitate to ask any questions.
@luispabon useful link how to inject your custom implementations https://github.com/neomerx/json-api/wiki/Extending-Encoder
Don't be, it was a 5 minute job. We have integrated this with slim 3, and in our slim container set up we had:
$container['codecMatcher'] = function (ContainerInterface $c) {
[ ...]
$matcher->registerEncoder($mediaType, function() use ($settings, $schema) {
$map = [];
foreach ($schema->getTypes() as $resourceType => $definition) {
$map[$definition->getEntityClass()] = function ($factory, $container) use ($schema, $resourceType) {
return new NeomerxSchema($factory, $container, $schema, $resourceType);
};
}
[...]
});
$matcher->registerDecoder($mediaType, function() {
return new ObjectDecoder();
});
$parser = $factory->createHeaderParametersParser();
$headerParameters = $parser->parse($request);
$checker = $factory->createHeadersChecker($matcher);
$checker->checkHeaders($headerParameters);
return $matcher;
};
Which we had to change to
[ ...]
foreach ($schema->getTypes() as $resourceType => $definition) {
$map[$definition->getEntityClass()] = function (Neomerx\JsonApi\Factories\Factory $factory) use ($schema, $resourceType) {
return new NeomerxSchema($factory, $factory->createContainer(), $schema, $resourceType);
};
}
[ ...]