Skip to content

Commit

Permalink
Attempt to use EventSubscriber
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Feb 5, 2025
1 parent 4a89208 commit c6d3b95
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<?php

namespace Civi\LegacyFinder;

use Civi\Core\Event\GenericHookEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class CRM_Dedupe_BAO_Finder implements EventSubscriberInterface {

class Finder {
public static function getSubscribedEvents(): array {
return [
'hook_civicrm_findExistingDuplicates' => ['findExistingDuplicates', -5],
];
}

/**
* This function exists to provide legacy hook support for finding duplicates.
Expand Down
6 changes: 3 additions & 3 deletions ext/legacydedupefinder/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
<compatibility>
<ver>[civicrm.majorVersion]</ver>
</compatibility>
<tags>
<tag>mgmt:hidden</tag>
</tags>
<comments>This adds backwards compatibility for dedupe hooks. If you do not need them you can improve dedupe performance by disabling this</comments>
<mixins>
<mixin>[email protected]</mixin>
</mixins>
<classloader>
<psr0 prefix="CRM_" path="."/>
<psr4 prefix="Civi\" path="Civi"/>
Expand Down
1 change: 0 additions & 1 deletion ext/legacydedupefinder/legacydedupefinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
*/
function legacydedupefinder_civicrm_config(&$config): void {
_legacydedupefinder_civix_civicrm_config($config);
\Civi::dispatcher()->addListener('hook_civicrm_findExistingDuplicates', ['\Civi\LegacyFinder\Finder', 'findExistingDuplicates'], -5);
}

/**
Expand Down

0 comments on commit c6d3b95

Please sign in to comment.