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 handling of usage
to DAO
generator
#25874
Conversation
(Standard links)
|
test this please |
b382d89
to
622955f
Compare
@colemanw I just hit another argument for YAPOM - the import code uses |
I like the direction of this. Wish I'd thought of it years ago. As it stands, there's going to be a lot of fudging to accommodate old daos without these flags, but eventually we can add noisy deprecations.
|
@colemanw do you have any thoughts on the second & last point in the technical details |
@eileenmcnaughton I agree with the 2nd point, because not including it for every field leads to ambiguity (does missing data == false or does it mean the dao needs to be regenerated?) To the last point, I prefer the flatter structure you've got now. We can always add more keys to the array, but I think nesting in more arrays is overkill. |
@colemanw OK - I can't think of a use-case for more nuance at the moment - but it's more than transforming from a bool to an array latter is tricky - but as you say there could be new array entries |
CRM/Core/CodeGen/Specification.php
Outdated
if ($usage['import'] === 'TRUE') { | ||
$field['import'] = $usage['import']; | ||
} | ||
if ($usage['export'] === 'TRUE') { | ||
$field['export'] = $usage['export']; |
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.
if ($usage['import'] === 'TRUE') { | |
$field['import'] = $usage['import']; | |
} | |
if ($usage['export'] === 'TRUE') { | |
$field['export'] = $usage['export']; | |
$field['import'] = $usage['import'] === 'TRUE' ? $usage['import'] : NULL; | |
$field['export'] = $usage['export'] === 'TRUE' ? $usage['export'] : NULL; |
820cd94
to
a582b95
Compare
@seamuslee001 @colemanw it has passed! The follow on steps from here go in a few different directions - fixing the api to return & preferably filter on usage (I probably need some help from @colemanw there) and fixing some of the DAO functions like |
<usage> | ||
<import>false</import> | ||
<export>true</export> | ||
<duplicate_matching>false</duplicate_matching> |
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.
I don't want to have to set tests going again now - but will add token
to this when I do a metadata pass
Overall, I also like the concept here. Definitely think it's better to split into a separate subkey.
+1 for the flatter structure.
Yeah, the tarball... I wouldn't worry about that. For the memory, let's ballpark it and see how we feel.
Putting those numbers together, the ballpark looks like this:
I think you're right to ask the question, but I'm not really sure the answer. At 18kb -- no problem. At 350kb or 1mb, hard to say. I'm not sure how to formulate a cut-off. |
@totten is there anything to be read into this test run seeming to take a bit longer than some other test runs (I looked at 2 others & they took less time) |
Not that I can see. There's some natural variation due to hardware differences, overall load, etc -- and (eg) the recent runs of |
Ok, I like the proposed structure so will merge this so @eileenmcnaughton can continue progressing on it. |
Regenerate DAOs with usage from #25874
Overview
Add handling of
usage
toDAO
generatorBefore
The use of the DAO field
import
is overloaded to imply import, export, usable for dedupe matching & a whole bunch of other things I haven't get figured out...After
new
usage
key on fields.During generation it will ALWAYS be added to the DAOs for each field like
If it is not in the xml it will make explicit what was implied anyway - ie
Technical Details
I have only included one regenerated DAO with 1 explicit field & the rest 'determined'. I would propose to do the rest of the DAOs as a follow up PR once merged (xmls only need to be updated as needed)
I explicity declared usage for each field. I prefer this explicitness but the counter argument is more file size for tar-balling or more use in memory / serializing
This doesn't add any usage - any potential usage should use in a way that falls back to the key not being there (not necessarily in a notice-free way)
it would be nice if sites could override these the way they do settings - ie easy for a site admin without an extension
I kinda wonder if we want to allow for more nuance later ie
Comments
@colemanw as discussed on chat