Skip to content

Commit

Permalink
EZP-32001: Skipped empty object state groups during indexing (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwojs authored Oct 7, 2020
1 parent 298adbc commit 0682401
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
namespace EzSystems\EzPlatformSolrSearchEngine\FieldMapper\ContentFieldMapper;

use eZ\Publish\API\Repository\Exceptions\NotFoundException;
use eZ\Publish\SPI\Persistence\Content;
use eZ\Publish\SPI\Persistence\Content\Location\Handler as LocationHandler;
use eZ\Publish\SPI\Persistence\Content\ObjectState\Handler as ObjectStateHandler;
Expand Down Expand Up @@ -192,10 +193,14 @@ protected function getObjectStateIds($contentId)
$objectStateIds = [];

foreach ($this->objectStateHandler->loadAllGroups() as $objectStateGroup) {
$objectStateIds[] = $this->objectStateHandler->getContentState(
$contentId,
$objectStateGroup->id
)->id;
try {
$objectStateIds[] = $this->objectStateHandler->getContentState(
$contentId,
$objectStateGroup->id
)->id;
} catch (NotFoundException $e) {
// // Ignore empty object state groups
}
}

return $objectStateIds;
Expand Down

0 comments on commit 0682401

Please sign in to comment.