Implement @SelectAlways() decorator
#19
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is related to the (closed) issue #8. This PR implements my proposal of a
@SelectAlways()decorator for columns.I found that if using, for example, an
@AfterLoad()that depends on fields in the entity, it would be cleaner to use a decorator instead of manually addingaddSelects for the fields (like you suggested). I originally considered to encapsulate thePerchQuerybuilder.generateQueryBuilder()with a custom function in order to add the selects, however, I don't think it is ideal to hardcode a list of fields that should be selected, thus this PR.This implementation only force-selects the column when its class relation is in the query: