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

Question: Why are TrustedGetters Set to True? #257

Closed
homestar9 opened this issue Jan 13, 2025 · 2 comments
Closed

Question: Why are TrustedGetters Set to True? #257

homestar9 opened this issue Jan 13, 2025 · 2 comments

Comments

@homestar9
Copy link
Contributor

quick/models/BaseEntity.cfc

Lines 2542 to 2555 in a4481cf

private void function setUpMementifier() {
param this.memento = {};
var defaults = {
"defaultIncludes" : retrieveAttributeNames( withVirtualAttributes = true ),
"defaultExcludes" : [],
"neverInclude" : [],
"defaults" : {},
"mappers" : {},
"trustedGetters" : true,
"ormAutoIncludes" : false
};
structAppend( defaults, this.memento, true );
this.memento = defaults;
}

@elpete, do you know why when Quick sets up the Mementifier, is trustedGetters set to true? Mementifier won't let you use custom mappers unless the key exists in the entity or trustedGetters is set to false. Would it break Quick if the default was changed here?

Related issue in Mementifier:
coldbox-modules/mementifier#40

@elpete
Copy link
Collaborator

elpete commented Jan 13, 2025

My understanding of trustedGetters here is it tells Mementifier to always call the getter even if no method exists. This is so Quick’s onMissingMethod can kick in, if needed.

@homestar9
Copy link
Contributor Author

Yeah, I am pretty sure you are correct. I was trying to come up with a nifty way to use memento mappers when the key may or may not exist in the entity. If you switch trustedGetters to false, then the mappers will always work, but will break Quick's onMissingMethod functionality.

Back to the drawing board. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants