Skip to content

Commit

Permalink
BUG Unset subquery sort in unlinkDisownedRelationship to avoid except…
Browse files Browse the repository at this point in the history
…ion on DB Drivers that disallow sub query sort (#325)

* unset sort for subquery if we're using MSSQL

* fix for travis check

* removed conditional sorting and disable sorting of subquery for all DB drivers

* renamed variable since it doesn't contain actual SQL anymore

* Removed unnecessary use statement
  • Loading branch information
t3hn0 authored Feb 24, 2021
1 parent 44487a3 commit 1685b88
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/RecursivePublishable.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,9 @@ public function unlinkDisownedRelationship($source, $targetStage, $relationship)
}

// Query the source for the list of items to NOT remove
$ownedSQL = $owner->getComponents($relationship)->sql($ownedParams);
$ownedQuery = $owner->getComponents($relationship);
// remove sort for sub query because some DB drivers don't let you sort sub queries
$ownedSQL = $ownedQuery->dataQuery()->sort(null, null, true)->sql($ownedParams);
$disowned->addWhere([
"\"{$targetTable}\".\"ID\" NOT IN (SELECT \"Source\".\"ID\" FROM ({$ownedSQL}) AS \"Source\")" => $ownedParams
]);
Expand Down

0 comments on commit 1685b88

Please sign in to comment.