0

I have Block question

class Question extends \Magento\Framework\View\Element\Template implements \Magento\Widget\Block\BlockInterface

in function

public function __construct(

        \Magento\Framework\View\Element\Template\Context $context,
        \Mageaddons\Productquestion\Model\ProductquestionFactory  $productQuestion, 
        \Mageaddons\Productquestion\Model\AnswerquestionFactory  $answersQuestion, 
        \Magento\Customer\Model\Session $customerSession,
        \Magento\Catalog\Block\Product\View $product,
        array $data = []
    ){
        $this->_productQuestion = $productQuestion;
        $this->_answersQuestion = $answersQuestion;
        $this->_customerSession = $customerSession;
        $this->_product = $product;
        parent::__construct($context,$data);
    }

when run get error

[2015-12-04 08:20:22] main.CRITICAL: Circular dependency: Mageaddons\Productquestion\Block\Product\Question depends on Mageaddons\Productquestion\Block\Product\Question and vice versa. [] []

any help. tks!
Edited when i comment

\Magento\Customer\Model\Session $customerSession,
\Magento\Catalog\Block\Product\View $product,

it work.
This block be use to add in Product View. .So how do get custommer isLoggedIn and product in product view.

  • did you clear your cache and var/generation directory after updating to latest code base? – Minesh Patel Dec 4 '15 at 8:41
  • yes but get error same. – xanka Dec 4 '15 at 8:44
  • check Circular Dependency Error in magento2 here – Minesh Patel Dec 4 '15 at 8:48
  • I edited my question @MineshPatel – xanka Dec 4 '15 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.