Skip to content

Commit

Permalink
Merge pull request #34 from craftpulse/develop-v5
Browse files Browse the repository at this point in the history
5.5.2
  • Loading branch information
cookie10codes authored Aug 2, 2024
2 parents bd2d2a3 + d1b3b42 commit b6aa417
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

### 5.5.2 - 2024-08-02

### Fixed
- Added section.all fallback for the deletion of documents

### 5.5.1 - 2024-07-15

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "craftpulse/craft-typesense",
"description": "Craft Plugin that synchronises with Typesense",
"type": "craft-plugin",
"version": "5.5.1",
"version": "5.5.2",
"keywords": [
"craft",
"cms",
Expand Down
16 changes: 11 additions & 5 deletions src/Typesense.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,16 +391,22 @@ function (ElementEvent $event) {
$entry = Entry::find()->id($element->id)->siteId($site['siteId'])->one();

if ($entry) {
$section = $entry->section->handle ?? null;
$sectionHandle = $entry->section->handle ?? null;
$type = $entry->type->handle ?? null;
$collection = null;
$resolver = null;
if ($section) {

if ($sectionHandle) {
if ($type) {
$section = $section . '.' . $type;
$section = $sectionHandle . '.' . $type;
$collection = CollectionHelper::getCollectionBySection($section);
}

// get the generic type if specific doesn't exist
if (is_null($collection)) {
$section = $sectionHandle . '.all';
$collection = CollectionHelper::getCollectionBySection($section);
}

$collection = CollectionHelper::getCollectionBySection($section);
}

if ($collection) {
Expand Down

0 comments on commit b6aa417

Please sign in to comment.