Hi everyone,
I need to add more logic to my \Shopware\Models\Blog\Repository::getBackendListQueryBuilder and for that I need to hook this repository.
I have my approach working fine but I get a console warning always I try to execute Shopware()->Models()->getRepository(‘Shopware\Models\Blog\Blog’)
Warning
PHP Warning: Declaration of Shopware_Proxies_ShopwareModelsBlogRepositoryProxy::getBackendListQueryBuilder($blogCategoryIds, $filter, $order) should be compatible with Shopware\Models\Blog\Repository::getBackendListQueryBuilder($blogCategoryIds, array $filter, $order) in /var/www/releases/20170306103132Z/var/cache/production_201610051330/proxies/ShopwareModelsBlogRepositoryProxy.php on line 2
If I check ShopwareModelsBlogRepositoryProxy.php I have:
public function getBackendListQueryBuilder($blogCategoryIds, $filter, $order)
{
return Shopware()->Hooks()->executeHooks(
$this, 'getBackendListQueryBuilder', array('blogCategoryIds'=>$blogCategoryIds, 'filter'=>$filter, 'order'=>$order)
);
}
And our repository class engine/Shopware/Models/Blog/Repository.php:318
public function getBackendListQueryBuilder($blogCategoryIds, array $filter, $order)
{
$builder = $this->getEntityManager()->createQueryBuilder();
$builder->select(
array(
'blog.id',
[...]
As you see $filter argument as type array on Repository Class and that isn’t present on Proxy Class, that’s why we get the warning.
If we try to remove ‘array’ the warning is out.
This means the generation of the proxy doesn’t have in account the type of argument.
What can I do to avoid this warning or should we open an issue for this?
Thanks.