Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'fix/4--duplicate-page-type' into signify
Browse files Browse the repository at this point in the history
  • Loading branch information
sig-peggy committed Oct 22, 2024
2 parents 58725b7 + 67612de commit e0af92c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Extensions/DataObjectExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,14 @@ private function removeItem(DataObject $item = null)
}

/**
* Push the item to Solr after publishing
* Clear old page type from Solr before publishing if required
*
* @throws ValidationException
* @throws HTTPException
* @throws ReflectionException
* @throws InvalidArgumentException
*/
public function onAfterPublish()
public function onBeforePublish()
{
// Check for changed classname and delete old record before pushing new if required.
if ($this->owner instanceof SiteTree) {
Expand All @@ -259,6 +259,18 @@ public function onAfterPublish()
$this->removeItem($lastPublished);
}
}
}

/**
* Push the item to Solr after publishing
*
* @throws ValidationException
* @throws HTTPException
* @throws ReflectionException
* @throws InvalidArgumentException
*/
public function onAfterPublish()
{
if ($this->shouldPush()) {
/** @var DataObject $owner */
$owner = $this->owner;
Expand Down

0 comments on commit e0af92c

Please sign in to comment.