diff --git a/.travis.yml b/.travis.yml index bf6ab20f..1c2d5155 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,8 +21,6 @@ jobs: env: DB=MYSQL RECIPE_VERSION=4.x-dev PHPUNIT_TEST=1 PHPCS_TEST=1 PDO=1 - php: 7.2 env: DB=PGSQL RECIPE_VERSION=4.x-dev PHPUNIT_COVERAGE_TEST=1 - - php: 7.2 - env: DB=PGSQL RECIPE_VERSION=4.x-dev PHPUNIT_COVERAGE_TEST=1 BACKWARD_COMPAT=1 - php: 7.3 env: DB=MYSQL RECIPE_VERSION=4.x-dev PHPUNIT_TEST=1 - php: 7.4 @@ -47,8 +45,8 @@ before_script: ######## Remove once GraphQL 4 is merged ######### - composer require silverstripe/admin:"dev-pulls/1/schemageddon as 1.x-dev" silverstripe/asset-admin:"dev-pulls/1/schemageddon as 1.x-dev" silverstripe/versioned-admin:"dev-pulls/1/schemageddon as 1.x-dev" silverstripe/cms:"dev-pulls/4/schemageddon as 4.x-dev" silverstripe/graphql:"4.x-dev as 3.x-dev" --no-update - - 'if [[ $BACKWARD_COMPAT ]]; then composer require silverstripe/graphql:"dev-pulls/3/schemageddon-compat as 3.x-dev" --no-update; fi' ################################################## + - 'if [[ $BACKWARD_COMPAT ]]; then composer require silverstripe/graphql:"dev-pulls/3/schemageddon-compat as 3.x-dev" --no-update; fi' - if [[ $DB == PGSQL ]]; then composer require silverstripe/postgresql:^2 --no-update; fi diff --git a/src/GraphQL/Resolvers/VersionFilters.php b/src/GraphQL/Resolvers/VersionFilters.php index 02054ce3..7dfb7fbb 100644 --- a/src/GraphQL/Resolvers/VersionFilters.php +++ b/src/GraphQL/Resolvers/VersionFilters.php @@ -3,6 +3,7 @@ namespace SilverStripe\GraphQL\Resolvers; use SilverStripe\ORM\DataList; +use SilverStripe\ORM\DataObject; use SilverStripe\ORM\RelationList; use SilverStripe\Versioned\Versioned; use InvalidArgumentException; @@ -97,8 +98,10 @@ public function applyToList(DataList $list, array $versioningArgs): DataList break; case 'status': // When querying by Status we need to ensure both stage / live tables are present - $baseTable = singleton($list->dataClass())->baseTable(); - $liveTable = $baseTable . '_Live'; + /* @var DataObject&Versioned $sng */ + $sng = singleton($list->dataClass()); + $baseTable = $sng->baseTable(); + $liveTable = $sng->stageTable($baseTable, Versioned::LIVE); $statuses = $versioningArgs['status']; // If we need to search archived records, we need to manually join draft table @@ -107,7 +110,7 @@ public function applyToList(DataList $list, array $versioningArgs): DataList ->setDataQueryParam('Versioned.mode', 'latest_versions'); // Join a temporary alias BaseTable_Draft, renaming this on execution to BaseTable // See Versioned::augmentSQL() For reference on this alias - $draftTable = $baseTable . '_Draft'; + $draftTable = $sng->stageTable($baseTable, Versioned::DRAFT); $list = $list ->leftJoin( $draftTable,