# TypeError: Argument 1 passed to

**URL:** https://forum.shopware.com/t/typeerror-argument-1-passed-to/44912
**Category:** International (English Only)
**Tags:** programming
**Created:** [30. März 2017 um 19:29 UTC](https://forum.shopware.com/t/typeerror-argument-1-passed-to/44912 "2017-03-30T19:29:33Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![armard](https://avatars.discourse-cdn.com/v4/letter/a/e9c0ed/32.png) [@armard](https://forum.shopware.com/u/armard)
#### Post date: [30. März 2017 um 19:29 UTC](https://forum.shopware.com/t/typeerror-argument-1-passed-to/44912/1 "2017-03-30T19:29:33Z")

</div>

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.&nbsp;  
So my question is, are there any workarounds&nbsp;(php version can not be changed)?&nbsp;
