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

Don't run queries when trying to retrieve versions for unsaved records #352

Conversation

maxime-rainville
Copy link
Contributor

@maxime-rainville maxime-rainville commented Feb 15, 2022

Right now if you call allVersions on a singleton DataObject, it will try to run a query ... which is nonsensical. This is causing grievances to our graphql --no-database build steps.

Parent issue

@maxime-rainville maxime-rainville force-pushed the pulls/1/dont-get-versions-on-null-db branch from 69be629 to 7991603 Compare February 16, 2022 03:37
@maxime-rainville maxime-rainville marked this pull request as ready for review February 16, 2022 04:44
@@ -893,6 +893,15 @@ public function testAllVersions()
$this->assertEquals($extraFields, ['2005', '2007', '2009'], 'Additional version fields returned');
}

public function testAllVersionsOnUnsavedRecord()
{
$newPage = new VersionedTest\Subclass();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those tests passed with the old logic.

Copy link
Contributor Author

@maxime-rainville maxime-rainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to call this a performance improvement that's worth doing ... irrespective of the NullDatabase work.

@maxime-rainville maxime-rainville changed the title WIP Try to suppress query when using NullDatabase Don't run queries when trying to retrieve versions for unsaved records Feb 16, 2022
@emteknetnz emteknetnz merged commit 10d0871 into silverstripe:1 Feb 16, 2022
@emteknetnz emteknetnz deleted the pulls/1/dont-get-versions-on-null-db branch February 16, 2022 05:40
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