Skip to content

Conversation

biozshock
Copy link
Contributor

Q A
Bug fix? (use the a.b branch)
New feature/enhancement? (use the a.x branch) ✔️
Deprecations? ✔️
BC breaks? (use the c.x branch) ✔️
Automated tests included? ✔️

Description

Removal of the getEntityManager from deprecated MauticFactory.
The only userspace part affected is the points trigger on URL hit.
Other parts please code review.


📋 Steps to test this PR:

  1. Open this PR on Gitpod or pull down for testing locally (see docs on testing PRs here)
  2. Create a pint -> action with the parameters:
  3. Change points: 1
  4. Action taken: Visits specific URL
  5. Page URL: https://HOST_NAME/mtracking.gif
  6. Create a page, and insert a tracking pixel: https://HOST_NAME/mtracking.gif
  7. Open the page in anonymous browser/window.
  8. See there are no errors while displaying the tracking pixel (HTTP code is 200)
  9. Check points were added.

Copy link

codecov bot commented Feb 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.67%. Comparing base (1fba7e8) to head (58cb5ee).
Report is 2 commits behind head on 6.x.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##                6.x   #14611   +/-   ##
=========================================
  Coverage     64.67%   64.67%           
- Complexity    34675    34676    +1     
=========================================
  Files          2273     2273           
  Lines        103596   103597    +1     
=========================================
+ Hits          66996    66998    +2     
+ Misses        36600    36599    -1     
Files with missing lines Coverage Δ
app/bundles/CoreBundle/Factory/MauticFactory.php 100.00% <ø> (ø)
app/bundles/EmailBundle/Helper/MailHelper.php 79.01% <100.00%> (ø)
...ndles/PageBundle/EventListener/PointSubscriber.php 100.00% <100.00%> (ø)
...pp/bundles/PageBundle/Helper/PointActionHelper.php 50.00% <100.00%> (+0.94%) ⬆️
app/bundles/PointBundle/Model/PointModel.php 77.33% <100.00%> (+1.14%) ⬆️

@biozshock biozshock force-pushed the factory-entitymanager branch 2 times, most recently from ed6924a to 0709cf4 Compare February 19, 2025 07:52
@RCheesley RCheesley added ready-to-test PR's that are ready to test code-review-needed PR's that require a code review before merging deprecation Includes deprecations points-scoring Anything related to points labels Feb 21, 2025
@RCheesley RCheesley added this to the 6.0.0-beta milestone Feb 21, 2025
Copy link
Member

@RCheesley RCheesley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I try to trigger the point change I get the following in the logs, the pixel throws a 500 error:

[2025-02-21T17:20:20.265849+00:00] mautic.CRITICAL: Uncaught PHP Exception ReflectionException: "Given object is not an instance of the class this method was declared in" at /var/www/html/app/bundles/PointBundle/Model/PointModel.php line 260 {"exception":"[object] (ReflectionException(code: 0): Given object is not an instance of the class this method was declared in at /var/www/html/app/bundles/PointBundle/Model/PointModel.php:260)
[stacktrace]
#0 /var/www/html/app/bundles/PointBundle/Model/PointModel.php(260): ReflectionMethod->invokeArgs()
#1 /var/www/html/app/bundles/PageBundle/EventListener/PointSubscriber.php(65): Mautic\\PointBundle\\Model\\PointModel->triggerAction()
#2 /var/www/html/vendor/symfony/event-dispatcher/Debug/WrappedListener.php(116): Mautic\\PageBundle\\EventListener\\PointSubscriber->onPageHit()
#3 /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php(220): Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener->__invoke()
#4 /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\\Component\\EventDispatcher\\EventDispatcher->callListeners()
#5 /var/www/html/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php(139): Symfony\\Component\\EventDispatcher\\EventDispatcher->dispatch()
#6 /var/www/html/app/bundles/PageBundle/Model/PageModel.php(661): Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher->dispatch()
#7 /var/www/html/app/bundles/PageBundle/Model/PageModel.php(467): Mautic\\PageBundle\\Model\\PageModel->processPageHit()
#8 /var/www/html/app/bundles/PageBundle/Model/Tracking404Model.php(27): Mautic\\PageBundle\\Model\\PageModel->hitPage()
#9 /var/www/html/app/bundles/PageBundle/Controller/PublicController.php(296): Mautic\\PageBundle\\Model\\Tracking404Model->hitPage()
#10 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(181): Mautic\\PageBundle\\Controller\\PublicController->indexAction()
#11 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw()
#12 /var/www/html/vendor/symfony/http-kernel/Kernel.php(197): Symfony\\Component\\HttpKernel\\HttpKernel->handle()
#13 /var/www/html/app/AppKernel.php(101): Symfony\\Component\\HttpKernel\\Kernel->handle()
#14 /var/www/html/app/middlewares/CORSMiddleware.php(76): AppKernel->handle()
#15 /var/www/html/app/middlewares/HSTSMiddleware.php(39): Mautic\\Middleware\\CORSMiddleware->handle()
#16 /var/www/html/app/middlewares/CatchExceptionMiddleware.php(28): Mautic\\Middleware\\HSTSMiddleware->handle()
#17 /var/www/html/app/middlewares/Dev/IpRestrictMiddleware.php(52): Mautic\\Middleware\\CatchExceptionMiddleware->handle()
#18 /var/www/html/app/middlewares/VersionCheckMiddleware.php(58): Mautic\\Middleware\\Dev\\IpRestrictMiddleware->handle()
#19 /var/www/html/app/middlewares/TrustMiddleware.php(42): Mautic\\Middleware\\VersionCheckMiddleware->handle()
#20 /var/www/html/app/middlewares/StackedHttpKernel.php(55): Mautic\\Middleware\\TrustMiddleware->handle()
#21 /var/www/html/index.php(19): Mautic\\Middleware\\StackedHttpKernel->handle()
#22 {main}
"} {"hostname":"mautic6-web","pid":76157}

ruth-cheesley-me-uk-Mautic-02-21-2025_05_22_PM

No points are added as above.

@RCheesley RCheesley added the pending-feedback PR's and issues that are awaiting feedback from the author label Feb 21, 2025
@biozshock biozshock force-pushed the factory-entitymanager branch 9 times, most recently from c1318ba to 50d8242 Compare February 25, 2025 21:48
@RCheesley RCheesley removed the pending-feedback PR's and issues that are awaiting feedback from the author label Feb 26, 2025
@escopecz escopecz self-assigned this Feb 26, 2025
@RCheesley RCheesley modified the milestones: 6.0.0-beta, 7.0.0-alpha Feb 26, 2025
@RCheesley
Copy link
Member

I've bumped this to 7.0-alpha as there are still some things to be resolved in the tests.

@biozshock
Copy link
Contributor Author

@RCheesley tests were green, only a small code style issue is left.

@RCheesley
Copy link
Member

@biozshock not from here:

Remove-MauticFactory-getEntityManager-by-biozshock-·-Pull-Request-14611-·-mautic-mautic-02-26-2025_03_34_PM

It is untested after fixing the issues I reported, and with pending feedback, and we haven't got time to hold up the release further.

7.0-alpha will be out quite soon so it won't be long before it can be released.

@biozshock biozshock force-pushed the factory-entitymanager branch from d2f3151 to aa47c03 Compare February 26, 2025 21:38
@biozshock
Copy link
Contributor Author

@RCheesley yup, because new test case was added that interfered with the changes.

@escopecz
Copy link
Member

The failing test case is not a big issue. The issue is that the point handling must be refactored from static callbacks to events. It doesn't work like this.

@biozshock
Copy link
Contributor Author

biozshock commented Feb 27, 2025

@escopecz Sure, and i don't like how it's implemented now, but the point of this PR is to remove MauticFactory, not to refactor how PointSubscribers work.

You can create a new issue describing this problem with the PointSubscribers. And somebody will get it on track sooner or later.

@escopecz
Copy link
Member

@biozshock I get that. But I hope we agree that refactoring cannot be merged if it breaks the functionality as Ruth demonstrated. It must be refactored to actually work. This cannot be merged in this state.

@biozshock
Copy link
Contributor Author

@escopecz
Copy link
Member

@biozshock I stand corrected. I was looking for a commit or a comment in the PR history that would suggest that it was fixed and didn't find any. Could you maybe add additional commits instead of updating the original commit? I know that you want to make the git history clean but it's also hard to see what was changed when.

This is Ready to test now.

@escopecz escopecz requested a review from RCheesley February 27, 2025 10:05
@biozshock
Copy link
Contributor Author

@escopecz , yes, true, in this case when something was fixed - this could use a commit, or at least a comment to indicate the fix.

@biozshock biozshock force-pushed the factory-entitymanager branch from aa47c03 to 58cb5ee Compare March 4, 2025 21:39
Copy link
Member

@RCheesley RCheesley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirm that this is now working as expected, point actions are correctly adding the points as expected.

@RCheesley RCheesley added pending-test-confirmation PR's that require one test before they can be merged and removed ready-to-test PR's that are ready to test labels Mar 5, 2025
@RCheesley RCheesley moved this from 🦸🏻 Needs 2 tests to ⏳︎ Needs 1 more test in Open Source Fridays Mar 5, 2025
Copy link
Member

@escopecz escopecz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no issues in the code 👍 Thank you!

@escopecz escopecz merged commit 4e2086c into mautic:6.x Mar 5, 2025
17 checks passed
@github-project-automation github-project-automation bot moved this from ⏳︎ Needs 1 more test to 🥳 Done in Open Source Fridays Mar 5, 2025
@escopecz escopecz added refactoring The change does not change behavior but improves the code code-review-passed PRs which have passed code review user-testing-passed PRs which have been successfully tested by the required number of people. and removed code-review-needed PR's that require a code review before merging pending-test-confirmation PR's that require one test before they can be merged labels Mar 5, 2025
@escopecz escopecz modified the milestones: 7.0.0-alpha, 6.0.0-beta Mar 5, 2025
@RCheesley RCheesley modified the milestones: 6.0.0-beta, 6.0.0-beta2 Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-review-passed PRs which have passed code review deprecation Includes deprecations points-scoring Anything related to points refactoring The change does not change behavior but improves the code user-testing-passed PRs which have been successfully tested by the required number of people.
Projects
Status: 🥳 Done
Development

Successfully merging this pull request may close these issues.

3 participants