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

Prevent an exception when a Mautic user is test submitting a form #4415

Merged
merged 1 commit into from Jul 17, 2017

Conversation

@alanhartless
Copy link
Contributor

commented Jul 14, 2017

Q A
Bug fix? y
New feature?
Related user documentation PR URL
Related developer documentation PR URL
Issues addressed (#s or URLs)
BC breaks?
Deprecations?

Description:

2.9.0 introduced a bug when a user is logged into Mautic and tries to submits the form in the same browser session, an exception is thrown.

Steps to reproduce the bug:

  1. Login to Mautic and view the submit page for a form in the same browser (/form/ID).
  2. Submit the form which will result in an exception because Lead doesn't have an ID

Steps to test this PR:

  1. Repeat and this time the form will submit

@alanhartless alanhartless added this to the 2.10.0 milestone Jul 14, 2017

@virlatinus
Copy link
Contributor

left a comment

Tested it and it works

@escopecz

This comment has been minimized.

Copy link
Member

commented Jul 17, 2017

For the record, the error message was:

Uncaught PHP Exception Doctrine\ORM\ORMInvalidArgumentException: "A new entity was found through the relationship 'Mautic\FormBundle\Entity\Submission#lead' that was not configured to cascade persist operations for entity: Mautic\LeadBundle\Entity\Lead with ID #. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example @ManyToOne(..,cascade={"persist"})."

@escopecz
Copy link
Member

left a comment

The submission when logged in as a Mautic user worked 👍

@escopecz escopecz merged commit 0b00b8c into mautic:staging Jul 17, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@rc125

This comment has been minimized.

Copy link
Contributor

commented Jul 17, 2017

I updated the file and now i get another error. Its now through the relationship in Mautic\LeadBundle\Entity\ListLead

[2017-07-17 20:42:39] mautic.CRITICAL: Uncaught PHP Exception Doctrine\ORM\ORMInvalidArgumentException: "A new entity was found through the relationship 'Mautic\LeadBundle\Entity\ListLead#lead' that was not configured to cascade persist operations for entity: Mautic\LeadBundle\Entity\Lead with ID #. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example @ManyToOne(..,cascade={"persist"})." at /var/www/mautic/vendor/doctrine/orm/lib/Doctrine/ORM/ORMInvalidArgumentException.php line 92 {"exception":"[object] (Doctrine\\ORM\\ORMInvalidArgumentException(code: 0): A new entity was found through the relationship 'Mautic\\LeadBundle\\Entity\\ListLead#lead' that was not configured to cascade persist operations for entity: Mautic\\LeadBundle\\Entity\\Lead with ID #. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example @ManyToOne(..,cascade={\"persist\"}). at /var/www/mautic/vendor/doctrine/orm/lib/Doctrine/ORM/ORMInvalidArgumentException.php:92)"} []

@gap1590

This comment has been minimized.

Copy link

commented Jul 18, 2017

It works. Thanks guys.

@alanhartless alanhartless deleted the alanhartless:bug-user-form-submit branch Jul 24, 2017

@matishaladiwala matishaladiwala modified the milestones: 2.10.0, 2.9.1 Jul 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.