Skip to content

Commit

Permalink
Merge pull request #15 from chrometoasters/pulls/14-remove-cascade-de…
Browse files Browse the repository at this point in the history
…lete

Remove $cascase_delete so that terms don't get removed with the relation
  • Loading branch information
normann authored Dec 19, 2019
2 parents 799e5c0 + ffc6bbe commit 910eb70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
5 changes: 0 additions & 5 deletions src/Extensions/DataObjectTaxonomiesDataExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ class DataObjectTaxonomiesDataExtension extends DataExtension
'Tags',
];

// Delete the joining objects when the owner gets deleted
private static $cascade_deletes = [
'Tags',
];

// Duplicate the joining objects when the owner gets duplicated
private static $cascade_duplicates = [
'Tags',
Expand Down
8 changes: 4 additions & 4 deletions tests/TaxonomyTermTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,19 +496,19 @@ public function testOwnerObjectOwnsTaxonomyTerm()
$object1FromLive = OwnerObject::get()->byID($object1->ID);
$this->assertNull($object1FromLive, 'object1 doesn\'t exist on Live table after being unpublished');
$rootTerm1FromLive = TaxonomyTerm::get()->byID($rootTerm1->ID);
$this->assertNull(
$this->assertNotNull(
$rootTerm1FromLive,
'rootTerm1 doesn\'t exist on Live table after object1 being unpublished'
'rootTerm1 still exists on Live after object1 being unpublished'
);

$object1->doArchive();
Versioned::set_stage(Versioned::DRAFT);
$object1FromStage = OwnerObject::get()->byID($object1->ID);
$this->assertNull($object1FromStage, 'object1 doesn\'t exist on Stage table after being archived');
$rootTerm1FromStage = TaxonomyTerm::get()->byID($rootTerm1->ID);
$this->assertNull(
$this->assertNotNull(
$rootTerm1FromStage,
'rootTerm1 doesn\'t exist on Stage table after object1 being archived'
'rootTerm1 still exists on Stage after object1 being archived'
);

// Restore the orig archived stage
Expand Down

0 comments on commit 910eb70

Please sign in to comment.