-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
Add entity-types-php mixin #24947
Add entity-types-php mixin #24947
Conversation
(Standard links)
|
@totten What would be required to get civix to take advantage of this mixin? Currently civix writes the contents of every Edit: Hmm, now I see this comment in civix that suggests it may not be so easy:
@totten what do you think the boot-loading issue would be? Currently the delegated hook works, which means that extensions are all loaded when the hook is called. Wouldn't that mean mixins are loaded as well? |
Could we use this as the chance for a new hook which is loaded post-boot. I feel like having a second hook for 'most' entities might help us regain some sanity |
If it's still an issue, then I'd also consider a second hook. However, I'm not sure it's a still an issue. For a while, it was a bit of a pet-peeve for me -- because I found it rather confusing how
One risk to think about - if an extension taps into |
Update: I've tried this out locally by switching SearchKit to use the mixin, and everything seems to work fine. Pushed it to this PR so let's see how the tests like it... |
88b5352
to
8de7881
Compare
I've been trying this mixin with a couple other extensions and different versions of civicrm-core. The other extensions were With With
So (based on light testing) (Anecdotally, I thought I saw more interesting edges where there were momentary upgrade-failures circa 5.43-5.47, but they only appeared in some adhoc runs. When I used the more disciplined script, then that went away. It could've been procedural inconsistency. That's why I switched to testing via script.) It's fair to add
|
@totten it sounds like the bottom line for this PR is that you should hit the |
This is similar to the existing phpEval() helper, but it only calls one function, and it handles escaping the params. Tangentially, relax the return type for `phpEval()` - since it's equally valid to return scalars.
Added more test coverage. Merge on pass. |
To some extent, there's implicit coverage because `search_kit` uses `entity-types-php@1`. But this goes a bit further, ensuring that the entity-type metadata is maintained consistently across different stages of lifecycle (enable/disable/uninstall) and styles of interaction (eg local-only phpunit and multi-process cv CLI).
348c71e
to
61cb60c
Compare
Overview
This adds a new mixin to scan for entity types.
Before
Entity types are pre-scanned and compiled by civix into an extension's
.civix.php
file.After
Now there's a new mixin and civix could be adapted to take advantage of it.