BlackbitDigitalCommerce / pimcore-data-director

Import Bundle for Pimcore
16 stars 3 forks source link

Data director adds own path formatter to all relations. #106

Open ascheider opened 1 year ago

ascheider commented 1 year ago

I have currently the problem with data director: 3.4 @DataDirectorSearchViewPathFormatter is always added as formatter class if you save a class or rebuild classes.

image

How can i prevent it?

BlackbitDevs commented 1 year ago

Of course this is an opinionated feature. First question: You are the first who dislikes it and prefers Pimcore's default formatter (with full path). The DataDirectorSearchViewPathFormatter automatically shows the fields of the referenced items' class which are configured to be shown in search. Imho, most of the times this is a far better default than the full path.

Here is an excerpt from the DD manual:

Path formatter

Relational fields support path formatters to define the display of the related item. Data Director comes with a universal implementation which uses the fields of the related item, which are configured to be shown in the search view, also in the relation field view. To use this, set Formatter service / class of the relational field to @DataDirectorSearchViewPathFormatter.

This gets done automatically for all relational fields which do not have a Formatter service / class. If you prefer to show the full path of the related item (= Pimcore's default display of relations), please use @DefaultPathFormatter.

If you prefer to show the fields which are configured to be shown in the grid view, you can use @DataDirectorGridViewPathFormatter.

ascheider commented 1 year ago

@BlackbitDevs Thanks for your feedback. I have a class with relations to another objects, where i show id and path: image After data director applies formatter, i have this output: image The path output is somehow broken and outputs 1 - 1

ascheider commented 1 year ago

@BlackbitDevs @DefaultPathFormatter works fine and i have output like before. Thanks!

BlackbitDevs commented 1 year ago

@BlackbitDevs Thanks for your feedback. I have a class with relations to another objects, where i show id and path: image After data director applies formatter, i have this output: image The path output is somehow broken and outputs 1 - 1

Which fields are configured to be "visible in search result" for class PriceListGroup and PriceListPropertyGroup? And of which type are they?