-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
Group Contact create -> fix to use post hook for subscription records #22419
Conversation
(Standard links)
|
CRM/Contact/BAO/GroupContact.php
Outdated
} | ||
$params = $event->object->toArray(); | ||
try { | ||
SubscriptionHistory::save(FALSE)->setRecords([$params])->execute(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@colemanw I was worried about whether the subscription is created so I added test cover for it - in the process I added the SubscriptionHistory entity so as part of that I figured I might as well call that from the hook here - however, it writes and then gets rolled back - I'm a bit mystified as to why
da0d300
to
c0ec644
Compare
Test fail is Stacktrace /home/jenkins/bknix-dfl/build/core-22419-55dv3/web/sites/all/modules/civicrm/tests/phpunit/api/v3/GroupContactTest.php:237 per comment above - I can fix by not calling the api & just calling writeRecords - but I'd like to understand why - since I've seen unexplained api rollbacks before & never gotten to the bottom |
@eileenmcnaughton we can start by adding the entity #22435 |
thanks @colemanw -regarding unexpected rollbacks (as replicated in the unit test here) - that seems to be an active discussion on chat too - |
Where on chat @eileenmcnaughton ? |
@colemanw there is some concern about rollbacks in IATS - I haven't dug in at all though - but in this case - the record is being written to the table in the post hook but NOT being committed - |
d3db4da
to
3dbfaac
Compare
@colemanw this is passing now .... |
CRM/Contact/BAO/GroupContact.php
Outdated
/** | ||
* | ||
* @package CRM | ||
* @copyright CiviCRM LLC https://civicrm.org/licensing | ||
*/ | ||
class CRM_Contact_BAO_GroupContact extends CRM_Contact_DAO_GroupContact { | ||
class CRM_Contact_BAO_GroupContact extends CRM_Contact_DAO_GroupContact implements \Civi\Test\HookInterface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class CRM_Contact_BAO_GroupContact extends CRM_Contact_DAO_GroupContact implements \Civi\Test\HookInterface { | |
class CRM_Contact_BAO_GroupContact extends CRM_Contact_DAO_GroupContact implements \Civi\Core\HookInterface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eileenmcnaughton this was renamed since Jan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@colemanw OK - fixed
Overview
Update GroupContact method to create Subscription records in the post hook
Before
Done in the create method
After
Done in a post hook
Technical Details
Some complexities in getting the tests to pass mean this was left out when @colemanw did the others - should be passing now
Comments