Skip to content

Commit

Permalink
use stageTable
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Carlino committed Nov 12, 2020
1 parent 1392b0c commit cdf4980
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 5 additions & 2 deletions src/GraphQL/Resolvers/VersionFilters.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cdf4980

Please sign in to comment.