Mapping Providers

Objectiphy comes with a mapping provider for PHP attributes (requires PHP 8 or above), or annotations, but if you want to store your mapping information some other way, you could write your own class that implements MappingProviderInterface, and call setMappingProvider on the factory before creating your repository. Your custom class would have to convert your mapping information from whatever format it is stored in, to Table, Relationship, and Column objects.

Objectiphy has its own annotations, but it can also use Doctrine attributes or annotations. This allows us to re-use entities that were written for Doctrine, but amend the mapping information for use with Objectiphy if required, without breaking any existing code that uses Doctrine. Objectiphy will first look for Doctrine annotations, and then override those values with the ones from any Objectiphy annotations or PHP attributes. Not all Doctrine values are recognised by Objectiphy however.

Last updated