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

API New $class arg for DataObjectModel->getModelTypeForField() #395

Merged

Conversation

chillu
Copy link
Member

@chillu chillu commented Jul 2, 2021

Avoids calling accessField() which in turn calls DataObject->obj(). It isn't directly interested in the actual return value, but rather the type of this return value. Due to the way the ORM and DataObject is built, we can't guarantee lazy evaluation of those return values. Some of them cause database queries. One example here is Versioned->versions(), which performs in-memory operations on a (lazy) DataList that turn it into a (concrete) ArrayList.

Performing database queries slows down schema generation, but more importantly the database might not be available when we build the schema as part of a deployment operation (rather than a dev or production environment). For example, when creating a deployment package on CircleCI which then gets transferred to the actual production environment.

Context: #388

@unclecheese unclecheese merged commit 7602dbd into silverstripe:master Nov 4, 2021
@unclecheese unclecheese deleted the pulls/explicit-model-class branch November 4, 2021 22:23
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

Successfully merging this pull request may close these issues.

2 participants