I have Override \Magento\Catalog\Block\Product\View
Block in which i can not get store information.
I have use \Magento\Store\Model\StoreManagerInterface $storeManager
but it throws following error.
Fatal error: Uncaught
TypeError
: Argument 12 passed to
Tecksky\Catalog\Block\Product\Specification::__construct()
must
implement interfaceMagento\Store\Model\StoreManagerInterface,
array
given, called in
/home/sysadmin/share/magento2/project/generated/code/Tecksky/Catalog/Block/Product/Specification/Interceptor.php
on line 14 and defined in
/home/sysadmin/share/magento2/project/app/code/Tecksky/Catalog/Block/Product/Specification.php:12
Stack trace: `#0
/home/sysadmin/share/magento2/project/generated/code/Tecksky/Catalog/Block/Product/Specification/Interceptor.php(14):
Best Answer
You can directly call store manager in your block file, Just keep below class in your construct,
If you needed storemanager you can directly call in your file as below way,
$this->_storeManager->getStore()->getId()
Remove generated folder from root and check.