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

(REF) dev/core#1744 - Simplify Afform event naming #20555

Merged

Conversation

ahed-compucorp
Copy link
Contributor

@ahed-compucorp ahed-compucorp commented Jun 8, 2021

Overview

This PR replaces the last usage of constants for event names in CiviCRM code base with string literal.

Before

The ext/afform/core/afform.php file uses constants for event names.

-  Civi::dispatcher()->addListener(Submit::EVENT_NAME, [Submit::class, 'processContacts'], 500);                                                                         
-  Civi::dispatcher()->addListener(Submit::EVENT_NAME, [Submit::class, 'processGenericEntity'], -1000);                                                                  

After

The ext/afform/core/afform.php file uses string literal for event names.

+  Civi::dispatcher()->addListener('civi.afform.submit', ['\Civi\Api4\Action\Afform\Submit', 'processContacts'], 500);                                                   
+  Civi::dispatcher()->addListener('civi.afform.submit', ['\Civi\Api4\Action\Afform\Submit', 'processGenericEntity'], -1000);  

Technical Details

Since CiviCRM 5.26, the convention was to use string literal for event names and the usage of constants was deprecated according to this issue dev/core#1744. This was the last usage of constants for event names in CiviCRM code base.

Comment

Also, it addresses the failing deployments for two of our sites with afform extension enabled after deploying them on another server e.g. creating dev/staging sites.

I've seen the following error on two sites that had afform extension enabled recently:

$ drush cc all
Error: Class "Civi\Api4\Action\Afform\Submit" not found in afform_civicrm_config() (line 52 of civicrm/ext/afform/core/afform.php).
Drush command terminated abnormally due to an unrecoverable error

@civibot
Copy link

civibot bot commented Jun 8, 2021

(Standard links)

@civibot civibot bot added the master label Jun 8, 2021
ahed-compucorp added a commit to ahed-compucorp/civicrm-core that referenced this pull request Jun 8, 2021
@colemanw
Copy link
Member

colemanw commented Jun 8, 2021

Looks good to me.

@eileenmcnaughton eileenmcnaughton merged commit 25b95f1 into civicrm:master Jun 8, 2021
ahed-compucorp added a commit to ahed-compucorp/civicrm-core that referenced this pull request Jun 9, 2021
ahed-compucorp added a commit to compucorp/civicrm-core that referenced this pull request Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants