I am developing a plugin, where I need to update the „QueryBuilderFactory“ class. For that reason I subscribed to the „Enlight_Bootstrap_AfterInitResource_shopware_searchdbal.dbal_query_builder_factory“ event, and in the listener I am setting my own created class by following code:
$coreService = Shopware()->Container()->get(‚shopware_searchdbal.dbal_query_builder_factory‘);
Shopware()->Container()->set(‚shopware_searchdbal.dbal_query_builder_factory‘, new QueryBuilderFactory($coreService, $this));
Where QueryBuilderFactory is the class that I have created, the namespace is different. But unfortunately In the listing page I am getting the following error:
core.ERROR: TypeError: Argument 1 passed to Shopware\Bundle\SearchBundleDBAL\FacetHandler\VoteAverageFacetHandler::__construct() must be an instance of Shopware\Bundle\SearchBundleDBAL\QueryBuilderFactory, instance of Shopware_Components\ListingUpdate\Bundle\SearchBundleDBAL\QueryBuilderFactory given
The php version of server is 7.0.9. So I guess it has something to do with the PHP version, because I read that in PHP 7 this strict mode for types is introduced.
So my question is, are there any workarounds (php version can not be changed)?