Skip to content

Allow custom formatting of objectID #240

@mkilmanas

Description

@mkilmanas

Description
Right now, SearchEntity has a fixed method to generate the objectID from doctrine's primary key. The problem is that objectIDs are limited in what characters they can contain (e.g. : is disallowed) - so this limits what values can be used in the Doctrine's entity fields if the entity has to be indexable/searchable.
We need a possibility to override/customize this method in order to map entity data to acceptable objectID.

Basic example
In our case we have CustomerAccount entity, which has a composite primary key made of two columns 'context' and 'account_id'. However, account_ids sometimes contain : character, which is not allowed in ObjectID, so these entities fail to to be indexed.

Other
There are multiple ways how this could be addressed, here's a few rough ideas:

  • Introduce IdNormalizerInterface so that custom service can be implemented and then it would be used to generate the id for the SearchEntity
  • Allow configuration to tell which entity getter should be called to get the objectID for it
  • Generally make the current method cleanup the value to be compatible with the engine requirements (as long as ObjectID is never used for mapping back to the entity). Or it could use even use a hash function for objectID (and include the raw values as attributes)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions