Skip to content

Conversation

rela589n
Copy link
Contributor

In the scope of doctrine/persistence#433 (available from doctrine/persistence >= 4.1) there was added ColocatedMappingDriver::$classLocator (ClassLocator) property, which allows passing any instance of ClassLocator for the mapping driver to use. This commit integrates those changes into AttributeDriver.

Since doctrine/orm maintains the support for doctrine/persistence of older versions, tests ensure that ClassLocator actually exists.

The old paths' behaviour can be adapted into the new by passing FileClassLocator into AttributeDriver (see FileClassLocator::createFromDirectories($directoryPaths)).

The current PR supersedes #12106 .
There's also a PR for ODM doctrine/mongodb-odm#2802

Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this implementation; it looks promising!

@rela589n rela589n force-pushed the 3.6.x-class-locator-doctrine-persistence-4.1 branch 3 times, most recently from d6d4848 to 78d0c0f Compare August 21, 2025 08:42
@rela589n rela589n force-pushed the 3.6.x-class-locator-doctrine-persistence-4.1 branch 2 times, most recently from 87b20ac to b2290c5 Compare August 21, 2025 09:03
@greg0ire
Copy link
Member

Looks like we could release 4.1.0, WDYT @GromNaN ?

Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, let's release doctrine/persistence: 4.1.0

In the scope of doctrine/persistence#433
(available from `doctrine/persistence` >= 4.1) there was added
`ColocatedMappingDriver::$classLocator` (`ClassLocator`) property,
which allows passing any instance of `ClassLocator` for the mapping
driver to use. This commit integrates those changes into `AttributeDriver`.

Since `doctrine/orm` maintains the support for `doctrine/persistence`
of older versions, tests ensure that `ClassLocator` actually exists.

The old paths' behaviour can be adapted into the new by passing
`FileClassLocator` into `AttributeDriver`
(see `FileClassLocator::createFromDirectories($directoryPaths)`).
@rela589n rela589n force-pushed the 3.6.x-class-locator-doctrine-persistence-4.1 branch from b2290c5 to ed9ba16 Compare August 23, 2025 11:27
@greg0ire greg0ire added this to the 3.6.0 milestone Aug 25, 2025
@greg0ire greg0ire merged commit ceb04bf into doctrine:3.6.x Aug 25, 2025
87 checks passed
@greg0ire
Copy link
Member

Thanks @rela589n !

@rela589n
Copy link
Contributor Author

rela589n commented Aug 26, 2025

Thank you, @greg0ire

Regarding the next steps, I think it's time to add support on the Symfony side.

I see two options:

First is to add the support to DoctrineBundle, DoctrineMongoDBBundle (and probably to DoctrinePHPCRBundle) - each in its own repository. These changes would be identical because they introduce Finder registration.

Another approach is to add a change to doctrine-bridge - adjust AbstractDoctrineExtension::registerMappingDrivers() to register the Finder for attribute driver type.

I'd prefer going with the second, what do you think?

@greg0ire
Copy link
Member

Deferring to @ostrolucky @GromNaN @nicolas-grekas here 🦶 ⚽

rela589n added a commit to rela589n/symfony that referenced this pull request Aug 27, 2025
In the scope of doctrine/persistence#433
(available from `doctrine/persistence` >= 4.1) there was added
`ColocatedMappingDriver::$classLocator`, which allows passing any
instance of `ClassLocator` for the mapping driver to use.

This commit integrates those changes into `AbstractDoctrineExtension`,
used by respective ORM, MongoDB-ODM, PHPCR-ODM bundles. The solution
registers a "mapping_class_finder" service that can be used by the
client code to customize class finding logic.

The changes come into play starting with doctrine/persistence >= 4.1,
and the actual registration happens only if `AttributeDriver` supports
`ClassLocator`.

Dependent libraries would adhere to the same interface, where
`ClassLocator` is in the first argument.

The changes were introduced for:
- ORM: doctrine/orm#12131;
- ODM: doctrine/mongodb-odm#2802;
- PHPCR ODM: doctrine/phpcr-odm#875.
rela589n added a commit to rela589n/symfony that referenced this pull request Aug 27, 2025
In the scope of doctrine/persistence#433
(available from `doctrine/persistence` >= 4.1) there was added
`ColocatedMappingDriver::$classLocator`, which allows passing any
instance of `ClassLocator` for the mapping driver to use.

This commit integrates those changes into `AbstractDoctrineExtension`,
used by respective ORM, MongoDB-ODM, PHPCR-ODM bundles. The solution
registers a "mapping_class_finder" service that can be used by the
client code to customize class finding logic.

The changes come into play starting with doctrine/persistence >= 4.1,
and the actual registration happens only if `AttributeDriver` supports
`ClassLocator`.

Dependent libraries would adhere to the same interface, where
`ClassLocator` is in the first argument.

The changes were introduced for:
- ORM: doctrine/orm#12131;
- ODM: doctrine/mongodb-odm#2802;
- PHPCR ODM: doctrine/phpcr-odm#875.
@GromNaN
Copy link
Member

GromNaN commented Aug 27, 2025

@rela589n See symfony/symfony#61535 to discuss the bundle and bridge integration.

rela589n added a commit to rela589n/symfony that referenced this pull request Aug 27, 2025
In the scope of doctrine/persistence#433
(available from `doctrine/persistence` >= 4.1) there was added
`ColocatedMappingDriver::$classLocator`, which allows passing any
instance of `ClassLocator` for the mapping driver to use.

This commit integrates those changes into `AbstractDoctrineExtension`,
used by respective ORM, MongoDB-ODM, PHPCR-ODM bundles. The solution
registers a "mapping_class_finder" service that can be used by the
client code to customize class finding logic.

The changes come into play starting with doctrine/persistence >= 4.1,
and the actual registration happens only if `AttributeDriver` supports
`ClassLocator`.

Dependent libraries would adhere to the same interface, where
`ClassLocator` is in the first argument.

The changes were introduced for:
- ORM: doctrine/orm#12131;
- ODM: doctrine/mongodb-odm#2802;
- PHPCR ODM: doctrine/phpcr-odm#875.
rela589n added a commit to rela589n/symfony that referenced this pull request Aug 27, 2025
In the scope of doctrine/persistence#433
(available from `doctrine/persistence` >= 4.1) there was added
`ColocatedMappingDriver::$classLocator`, which allows passing any
instance of `ClassLocator` for the mapping driver to use.

This commit integrates those changes into `AbstractDoctrineExtension`,
used by respective ORM, MongoDB-ODM, PHPCR-ODM bundles. The solution
registers a "mapping_class_finder" service that can be used by the
client code to customize class finding logic.

The changes come into play starting with doctrine/persistence >= 4.1,
and the actual registration happens only if `AttributeDriver` supports
`ClassLocator`.

Dependent libraries would adhere to the same interface, where
`ClassLocator` is in the first argument.

The changes were introduced for:
- ORM: doctrine/orm#12131;
- ODM: doctrine/mongodb-odm#2802;
- PHPCR ODM: doctrine/phpcr-odm#875.
rela589n added a commit to rela589n/symfony that referenced this pull request Aug 27, 2025
In the scope of doctrine/persistence#433
(available from `doctrine/persistence` >= 4.1) there was added
`ColocatedMappingDriver::$classLocator`, which allows passing any
instance of `ClassLocator` for the mapping driver to use.

This commit integrates those changes into `AbstractDoctrineExtension`,
used by respective ORM, MongoDB-ODM, PHPCR-ODM bundles. The solution
registers a "mapping_class_finder" service that can be used by the
client code to customize class finding logic.

The changes come into play starting with doctrine/persistence >= 4.1,
and the actual registration happens only if `AttributeDriver` supports
`ClassLocator`.

Dependent libraries would adhere to the same interface, where
`ClassLocator` is in the first argument.

The changes were introduced for:
- ORM: doctrine/orm#12131;
- ODM: doctrine/mongodb-odm#2802;
- PHPCR ODM: doctrine/phpcr-odm#875.
rela589n added a commit to rela589n/symfony that referenced this pull request Aug 27, 2025
In the scope of doctrine/persistence#433
(available from `doctrine/persistence` >= 4.1) there was added
`ColocatedMappingDriver::$classLocator`, which allows passing any
instance of `ClassLocator` for the mapping driver to use.

This commit integrates those changes into `AbstractDoctrineExtension`,
used by respective ORM, MongoDB-ODM, PHPCR-ODM bundles. The solution
registers a "mapping_class_finder" service that can be used by the
client code to customize class finding logic.

The changes come into play starting with doctrine/persistence >= 4.1,
and the actual registration happens only if `AttributeDriver` supports
`ClassLocator`.

Dependent libraries would adhere to the same interface, where
`ClassLocator` is in the first argument.

The changes were introduced for:
- ORM: doctrine/orm#12131;
- ODM: doctrine/mongodb-odm#2802;
- PHPCR ODM: doctrine/phpcr-odm#875.
rela589n added a commit to rela589n/symfony that referenced this pull request Aug 29, 2025
In the scope of doctrine/persistence#433
(available from `doctrine/persistence` >= 4.1) there was added
`ColocatedMappingDriver::$classLocator`, which allows passing any
instance of `ClassLocator` for the mapping driver to use.

This commit integrates those changes into `AbstractDoctrineExtension`,
used by respective ORM, MongoDB-ODM, PHPCR-ODM bundles. The solution
registers a "mapping_class_finder" service that can be used by the
client code to customize class finding logic.

The changes come into play starting with doctrine/persistence >= 4.1,
and the actual registration happens only if `AttributeDriver` supports
`ClassLocator`.

Dependent libraries would adhere to the same interface, where
`ClassLocator` is in the first argument.

The changes were introduced for:
- ORM: doctrine/orm#12131;
- ODM: doctrine/mongodb-odm#2802;
- PHPCR ODM: doctrine/phpcr-odm#875.
rela589n added a commit to rela589n/symfony that referenced this pull request Aug 29, 2025
In the scope of doctrine/persistence#433
(available from `doctrine/persistence` >= 4.1) there was added
`ColocatedMappingDriver::$classLocator`, which allows passing any
instance of `ClassLocator` for the mapping driver to use.

This commit integrates those changes into `AbstractDoctrineExtension`,
used by respective ORM, MongoDB-ODM, PHPCR-ODM bundles. The solution
registers a "mapping_class_finder" service that can be used by the
client code to customize class finding logic.

The changes come into play starting with doctrine/persistence >= 4.1,
and the actual registration happens only if `AttributeDriver` supports
`ClassLocator`.

Dependent libraries would adhere to the same interface, where
`ClassLocator` is in the first argument.

The changes were introduced for:
- ORM: doctrine/orm#12131;
- ODM: doctrine/mongodb-odm#2802;
- PHPCR ODM: doctrine/phpcr-odm#875.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants