Publish Objects per Locale #12130
Replies: 4 comments 10 replies
-
@dvesh3 any feedback would be much appreciated. |
Beta Was this translation helpful? Give feedback.
-
I think that is nothing Pimcore should handle and is application specific. What if you have more requirements than per language? should pimcore solve that then too.... |
Beta Was this translation helpful? Give feedback.
-
I wouldn't go that road because it adds huge complexity to Pimcore. Especially when thinking about further consequences like content f the query tables and querying, visualization in UI, fallback languages, creating new unpublished versions (per locale?), data inheritance, etc. Also, as outlined by @dpfaffenbauer, locale does not always equal to tenant. There are many other structures like specific tenants have multi-language content. These structures you cannot be handled with a published state per locale. So, I would use flexibility of the data model and suggest to use custom data attributes/state flags (whatever fits the use case) for that kind for requirement. |
Beta Was this translation helpful? Give feedback.
-
Have you found a solution to the problem? At the moment, the situation in Pimcore looks like this:
Previously, I used KnpDoctrineBehaviors translatable and in this package we have a separate table for the base entity and a separate table for localized data. But we have the ability to create objects for individual language versions. |
Beta Was this translation helpful? Give feedback.
-
Description
Publishing objects on a per-locale basis is something I need in many projects. Mostly because the client wants a single data object (e.g. product) and decide whether it is available for a specific locale or not. So, I figured, maybe I'm not the only one and this functionality could be a feature for Pimcore. Or maybe I am the only one and noone else needs this - in this case, maybe you can provide some details about your approach?
Let's have an example for clarification.
Example
Assume a
Product
class exists and the product index is setup as multi-tenant - with each tenant representing a locale (e.g.,en
,de
). Now, assume that the corresponding assortment tenants were implemented too - one per supported locale (e.g.,AssortmentTenantEn
,AssortmentTenantDe
).To exclude products from indexing, one would implement either
inIndex
orgetOSDoIndexProduct
. So, in this case, I'd implement the assortment tenant, since we have one per locale (see above), which makes it possible to check the object against a specific locale (e.g.,$inIndex = in_array($tenantLocale, $object->getAvailableLocales());
).Now, the product will no longer be indexed - which is what we wanted. However, we are not quite done just yet. Imagine the product was already indexed and the client decided to un-publish it for a specific locale only.
In this case, we also need to ensure that the prev. available URL is not available in the sitemap anymore. This means we need to create the sitemap based on our index, which will need some effort too (instead of just using Pimcore's
PublishedFilter
(which could handle the locale specific use case if this feature was added to Pimcore).Let's assume we implemented the sitemap generation correctly, we still may have users who bookmarked the prev. available URL - or they access the URL some other way (e.g., manually or via browser history). In this case, we'd need to implement some more logic and throw a
NotFoundHttpException
.Now, we've implemented everything as needed by the most basic implementation.
As you can see, this is quite the workload for something that - to me - should be a feature provided by Pimcore. Especially, since this feature may be needed for other use cases as well (e.g. blog).
Further thoughts
The most challenging parts probably are:
I'm really looking forward to the thoughts of you guys (both Pimcore & the community).
Beta Was this translation helpful? Give feedback.
All reactions