Skip to content

Utilize scan-classes mixin#523

Draft
jensschuppe wants to merge 1 commit intomasterfrom
scan-classes
Draft

Utilize scan-classes mixin#523
jensschuppe wants to merge 1 commit intomasterfrom
scan-classes

Conversation

@jensschuppe
Copy link
Collaborator

Follow-up to #520 (comment)

This converts global functions into class methods for proper class loading and avoiding declaration errors when using the scan-classes mixin.

There might be changes needed for optional dependencies like action-provider.

@jensschuppe jensschuppe requested a review from dontub March 17, 2026 13:27
@jensschuppe jensschuppe added the status:needs work There is code, but it needs additional work before it should be reviewed label Mar 17, 2026
@dontub
Copy link
Collaborator

dontub commented Mar 17, 2026

I think an own implementation of hook_civicrm_scanClasses is necessary because of classes extending Civi\ActionProvider\Action\AbstractAction which comes from an optional extension dependency and might not be available, resulting in:

Class "Civi\ActionProvider\Action\AbstractAction" not found

@ufundo
Copy link
Contributor

ufundo commented Mar 20, 2026

I think an own implementation of hook_civicrm_scanClasses is necessary because of classes extending Civi\ActionProvider\Action\AbstractAction which comes from an optional extension dependency and might not be available, resulting in:

An alternative is to put the classes which have another dependency into a subextension. This can be automatically enabled if and only if the dependencies are available. See civicrm/civicrm-core#34113

@jensschuppe
Copy link
Collaborator Author

An alternative is to put the classes which have another dependency into a subextension. This can be automatically enabled if and only if the dependencies are available. See civicrm/civicrm-core#34113

That's interesting (and apparently available since 6.10.0)! Seems documentation for that is still missing, and it would definitely be worth a blog post or mention in the dev mailing list.

Anyway, that's the approach to be taken here IMO.

@dontub
Copy link
Collaborator

dontub commented Mar 23, 2026

apparently available since 6.10.0

Can we already use this feature? 6.10 is the current ESR, though not all CiviCRM admins are fast when it comes to updates...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:needs work There is code, but it needs additional work before it should be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants