Closed pl1zahd closed 5 months ago
Not sure if it is the only way, but I've just used setter injection
class CategoryTransformer extends ElasticaToModelTransformer
{
private IriConverterInterface $iriConverter;
public function setIriConverter(IriConverterInterface $iriConverter): void
{
$this->iriConverter = $iriConverter;
}
and
CategoryTransformer:
calls:
- setPropertyAccessor:
- "@fos_elastica.property_accessor"
- setIriConverter:
- "@api_platform.symfony.iri_converter"
Hi,
first up, thanks for creating and maintaining such a wonderful piece of software!
I use the Doctrine ORM driver for my project in combination with Version 6.2.0 of this bundle. I have a use-case where it would be useful for me have another Service to be injected into a custom ElasticaToModelTransformer.
When I add no additional Services, I can already use my custom Transformer, but whenever I try to add another Service into the Constructor, it seems that the Index ist not registered in the RepositoryManager.
Every way I tried so far ended either with the Message
No repository is configured for index "objects"
.I've already tried to extend
FOS\ElasticaBundle\Transformer\AbstractElasticaToModelTransformer
,FOS\ElasticaBundle\Doctrine\AbstractElasticaToModelTransformer
and to just implement theFOS\ElasticaBundle\Transformer\ElasticaToModelTransformerInterface
.Here is my configuration:
Is it just not possible to add another Service via autowire / autoconfigure or do I have to decorate a service to overwrite the parameters?
If any information is missing that you need to have, let me know and I will update my question accordingly.
Thanks for any help in advance!