Hallo zusammen,
ich habe eine Verständnis-Frage zu Namespaces, speziell bei einem dekorierten Service.
Und zwar habe ich ProductSearch dekoriert, das funktioniert soweit auch wunderbar:
namespace MyPlugin\Bundle\SearchBundle;
use Shopware\Bundle\SearchBundle;
use Shopware\Bundle\StoreFrontBundle;
use Shopware\Bundle\SearchBundle\ProductSearch;
use Shopware\Bundle\SearchBundle\ProductSearchInterface;
class MyProductSearch implements ProductSearchInterface
{
private $productSearch;
public function __construct(ProductSearchInterface $productSearch)
{
$this->productSearch = $productSearch;
}
public function search(SearchBundle\Criteria $criteria, StoreFrontBundle\Struct\ProductContextInterface $context)
{
return $this->productSearch->search($criteria, $context);
}
}
Wenn ich allerdings search mit absoluten Namespaces und ohne den ersten beiden ‘use’ aufrufe, bekomme ich eine Fehlermeldung:
Declaration of …MyProductSearch::search() must be compatible with Shopware\Bundle\SearchBundle\ProductSearchInterface::search(Shopware\Bundle\SearchBundle\Criteria $criteria, Shopware\Bundle\StoreFrontBundle\Struct\ProductContextInterface $context)
public function search(Shopware\Bundle\SearchBundle\Criteria $criteria, Shopware\Bundle\StoreFrontBundle\Struct\ProductContextInterface $context)
Sollte das nicht auch funktionieren?
Viele Grüße
Andi