-
-
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
Remove campaign_id pseudoconstants #19463
Remove campaign_id pseudoconstants #19463
Conversation
(Standard links)
|
This DOES resolve the speed issue - the jury is out on the safety issue though - @seamuslee001 @mattwire @demeritcowboy |
Sounds like this is worth pushing forward then. A few notes on the safety issue: If we classify Civi's history 3 "eras", this is what should be considered for each:
|
@colemanw test fails relate |
Tests were covering that the campaign pseudoconstant exists. I've taken them out, as we now don't want it to exist. |
Jenkins re test this please |
I made #19471 to fix the Search Builder breakage caused by this PR and it ended up being a very nice improvement to that UI. @demeritcowboy would you be able to test that PR? |
Sure. |
I mentioned this in the dev-digest - what say we merge this after the rc is cut? |
@eileenmcnaughton sounds good. I've checked most places & feel this is safe, but can you just verify campaign fields in Reports & Extended Reports? |
@colemanw ok |
Pseudoconstants are intended for option lists small enough to be loaded into memory, whereas FKs are for options of any size. It is possible to have thousands of campaigns, and some sites do, which slows or breaks some UIs (first noticed in the Search Kit bulk update action). All these fields have both an FK and a pseudoconstant declared, which is redundant; both are not needed, and the pseudoconstant was unnecessarily hogging memory for sites with many campaigns.
0909b8d
to
dbf668e
Compare
Per above - merging now - I'll take a look at the reports & fix if need be once merged |
In our wmf unit tests I hit this bug So far extended reports & reports seem OK (I tested the contribution pivot table in extended reports and the contribution detail report in core) |
Overview
Improves performance by not loading (potentially huge) list of campaigns into memory.
Before
Entire list is loaded into memory for dynamic UIs like Search Kit, Afform, and the API Explorer.
After
Those UIs use an EntityRef autocomplete, which actually looks a bit nicer.
Technical Details
Pseudoconstants are intended for option lists small enough to be loaded into memory, whereas FKs are for options of any size.
It is possible to have thousands of campaigns, and some sites do, which slows or breaks some UIs (first noticed in the Search Kit bulk update action).
All these fields have both an FK and a pseudoconstant declared, which is redundant; both are not needed, and newer UIs will automatically switch to using an EntityRef based on the FK.
Comments
In theory this is safe to remove, however there may be some code somewhere that relies on the pseudoconstant existing. Stuff to check:
getoptions
calls trying to load campaigns? (I couldn't find any using grep)DAO::buildOptions('campaign_id')
? (don't see any)$form->addField('campaign_id')
? (not that I can tell)CRM_Core_Pseudoconstant
methods? (haven't found any)