Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circular dependency #146

Closed
WaPoNe opened this issue Jul 5, 2023 · 7 comments
Closed

Circular dependency #146

WaPoNe opened this issue Jul 5, 2023 · 7 comments

Comments

@WaPoNe
Copy link

WaPoNe commented Jul 5, 2023

System: Magento Version: Magento Open Source ver. 2.4.5/2.4.5-p3 Vanilla
PHP Version: 8.1
Gigya Version: gigya/magento2-im: 6.0.0/6.1.0

Issue description:
Installed the extension in a Vanilla instance, it works fine.
If I create my module with a frontend observer (<mage_dir>/app/code/Vendor/Module/etc/frontend/events.xml):

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="customer_session_init">
        <observer name="my_customer_session_init_observer" instance="Vendor\Module\Observer\SessionInit" />
    </event>
</config>

to get data from customer session (<mage_dir>/app/code/Vendor/Module/Observer/SessionInit.php)

public function execute(Observer $observer)
{
	/** @var Session $customerSession */
	$customerSession = $observer->getData('customer_session');
	$customer = $customerSession->getCustomer();
	$email = $customer->getEmail();
	..
}

when I try to login, I get this message error:
1 exception(s):
Exception #0 (LogicException): Circular dependency: Gigya\GigyaIM\Observer\FrontendMagentoCustomerEnricher depends on Gigya\GigyaIM\Helper\GigyaMageHelper and vice versa.

Could you solve the problem?
It is blocking a wide project.

@Ynhockey
Copy link
Collaborator

Ynhockey commented Jul 5, 2023

Hi @WaPoNe thanks for the heads up, we are looking into it. I think it happens when you download Magento and the extension, and then try to set up Magento when the extension is already present. Checking this possibility. Also: can you please open a ticket for better tracking? Thanks!

@WaPoNe
Copy link
Author

WaPoNe commented Jul 6, 2023

@Ynhockey the case I showed you is the simplest obtained after a deep debug.
"and then try to set up Magento when the extension is already present": what do you mean?
We started from a Magento 2.4.5. already online so already configured; in the staging environment we installed Gigya extension and it throws "Circular dependency" exception beacause of our regular module that gets information from customer session.
What's wrong in your opinion?

And then, where should I open the ticket you're mentioning?

@Ynhockey
Copy link
Collaborator

Hi @WaPoNe the patch on the bug/circular-dependency-issue branch should remove the circular dependency. We are also working on a bigger refactor, but this should do the trick in your case. Please let me know if this works on your test system, and at the same time we are also doing our own tests before release. Thanks!

@WaPoNe
Copy link
Author

WaPoNe commented Aug 10, 2023

Hi @Ynhockey,
I'll test it but where is the patch?

@Ynhockey
Copy link
Collaborator

It's on the bug/circular-dependency-issue branch. Compare link:
develop...bug/circular-dependency-issue

@WaPoNe
Copy link
Author

WaPoNe commented Aug 11, 2023

Hi @Ynhockey,
it seems the patch is working.
Anyway I opened a pull request (#148) to clean some unused declarations.

When the patch will be merged into the master branch?

@Ynhockey
Copy link
Collaborator

It's in 6.1.1, please let me know if there are additional issues.

@Ynhockey Ynhockey closed this as completed Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants