Add possibility for reusable ReindexProvider classes (BC Break ⚠️)#666
Merged
alexander-schranz merged 4 commits intoPHP-CMSIG:0.13from Mar 23, 2026
Conversation
dffe8cf to
48838a7
Compare
Member
|
What happened with the idea outlined in #615 (comment)? Not good anymore? 😊 |
Member
Author
|
@Toflar thx for the hint forgot about that :) |
059ad0c to
a99a693
Compare
a99a693 to
00556f5
Compare
Toflar
pushed a commit
to Toflar/cmsig-search
that referenced
this pull request
Apr 27, 2026
…HP-CMSIG#666) Currently it is not possible to create a reusable ReindexProvider as all ReindexProviders require to implement a static method `public static function getIndex(): string` we should get rid of them so people can create ReindexProviders which are reusable and just configurable by there constructor. This also add possibility to wrap / decorate ReindexProviders easier, which we require for ODM (PHP-CMSIG#81 PHP-CMSIG#661). ## BC Breaks The `ReindexProviderInterface` and `getIndex` method is not longer static and the interface was renamed to `StaticReindexProviderInterface` as in a `DynamicReindexProviderInterface` without getIndexName method will be added in upcoming PR: ```diff -class YourClass implements ReindexProviderInterface { +class YourClass implements StaticReindexProviderInterface { // ... - public static function getIndex(): string + public function getIndexName(): string { return 'test'; } } ``` If you need to support 0.12 and 0.13 the same time you can implement both methods and keep using the deprecated ReindexProviderInterface until 0.14 or 1.0: ```diff class YourClass implements ReindexProviderInterface { // ... public static function getIndex(): string { return 'index'; } + public function getIndexName(): string + { + return self::getIndex(); + } } ``` fixes PHP-CMSIG#615
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently it is not possible to create a reusable ReindexProvider as all ReindexProviders require to implement a static method
public static function getIndex(): stringwe should get rid of them so people can create ReindexProviders which are reusable and just configurable by there constructor.This also add possibility to wrap / decorate ReindexProviders easier, which we require for ODM (#81 #661).
BC Breaks
The
ReindexProviderInterfaceandgetIndexmethod is not longer static and the interface was renamed toStaticReindexProviderInterfaceas in aDynamicReindexProviderInterfacewithout getIndexName method will be added in upcoming PR:If you need to support 0.12 and 0.13 the same time you can implement both methods and keep using the deprecated ReindexProviderInterface until 0.14 or 1.0:
class YourClass implements ReindexProviderInterface { // ... public static function getIndex(): string { return 'index'; } + public function getIndexName(): string + { + return self::getIndex(); + } }fixes #615