Skip to content

WIP: ODM #661

Draft
alexander-schranz wants to merge 2 commits intoPHP-CMSIG:0.13from
alexander-schranz:feature/seal-odm
Draft

WIP: ODM #661
alexander-schranz wants to merge 2 commits intoPHP-CMSIG:0.13from
alexander-schranz:feature/seal-odm

Conversation

@alexander-schranz
Copy link
Copy Markdown
Member

@alexander-schranz alexander-schranz commented Mar 1, 2026

Currently prototyping I little around how we can add support to map directly to an object.

The first Idea is to create a OdmEngine which decorates the Engine and uses objects instead of arrays.

fixes #81

@alexander-schranz alexander-schranz added Require BC Break Requires a BC Break and so new major version features New feature or request DX Improves the developer experience labels Mar 1, 2026
@alexander-schranz alexander-schranz force-pushed the feature/seal-odm branch 3 times, most recently from 4dbc038 to 70b97fb Compare March 2, 2026 19:54
@alexander-schranz alexander-schranz changed the base branch from 0.12 to 0.13 March 2, 2026 19:54
alexander-schranz added a commit that referenced this pull request Mar 23, 2026
)

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 (#81 #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 #615
@alexander-schranz alexander-schranz force-pushed the feature/seal-odm branch 2 times, most recently from c782233 to 4028bd0 Compare April 9, 2026 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DX Improves the developer experience features New feature or request Require BC Break Requires a BC Break and so new major version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[New package] ODM/ORM based Datamapping to Document classes

1 participant