I have this error:
[Tue Dec 20 12:18:12.372646 2016] [:error] [pid 15395] [client 192.168.255.24:51090] PHP Fatal error: Uncaught Error: Cannot instantiate interface Magento\Catalog\Model\Layer\FilterableAttributeListInterface in /var/www/magento/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:73\nStack trace:\n#0 /var/www/magento/vendor/magento/framework/ObjectManager/ObjectManager.php(71): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Catalog...')\n#1 /var/www/magento/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(126): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Catalog...')\n#2 /var/www/magento/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(53): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\\Catalog...', NULL, 'filterableAttri...', 'Magento\\Catalog...')\n#3 /var/www/magento/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(82): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\\Catalog...', Array, Array)\n#4 /var/www/magento in /var/www/magento/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 73
My code is:
<?php
namespace Sistel\PosicionFiltros\Block\Filtros;
class Index extends \Magento\Framework\View\Element\Template
{
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Catalog\Model\Layer\Resolver $layerResolver,
\Magento\Catalog\Model\Layer\FilterList $filterList,
array $data = []
)
{
$this->_catalogLayer = $layerResolver->get();
$this->filterList = $filterList;
parent::__construct($context, $data);
}
public function getHelloWorldTxt()
{
$activeFilters = $this->filterList->getState()->getFilters($this->_catalogLayer);
var_dump($activeFilters);
exit;
return $activeFilters;
}
}
It is similar than other code in the core of magento 2. I don´t understand.