5

Magento2 shows this error:

Circular dependency: Magento\Customer\Model\Session depends on Magento\Customer\Model\Url and vice versa.

I have cleared var/cache and var/generation directory. But it doesn't work.
Does anyone know how to solve it?

3

This should not happen.
Make sure you have this in the di.xml of the customer module

<type name="Magento\Customer\Model\Session">
    <arguments>
        <argument name="configShare" xsi:type="object">Magento\Customer\Model\Config\Share\Proxy</argument>
        <argument name="customerUrl" xsi:type="object">Magento\Customer\Model\Url\Proxy</argument>
        <argument name="customerResource" xsi:type="object">Magento\Customer\Model\ResourceModel\Customer\Proxy</argument>
        <argument name="storage" xsi:type="object">Magento\Customer\Model\Session\Storage</argument>
        <argument name="customerRepository" xsi:type="object">Magento\Customer\Api\CustomerRepositoryInterface\Proxy</argument>
    </arguments>
</type>

this means that the session model would use as dependency Magento\Customer\Model\Url\Proxy instead of Magento\Customer\Model\Url.

Clear the var/generation folder in case something was wrongly generated.

1

There was an issue about is back on GitHub a while ago: https://github.com/magento/magento2/issues/762

Try to run the following to clear your cache and generation folders:

rm -Rf /path/to/magento2/var/cache/*
rm -Rf /path/to/magento2/var/generation/*
  • thanks.. but i have already checked this issue on GitHub. it not helped me to solve my problem – mr. max Jul 5 '16 at 7:26

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.