tuseto
Filament repeater translations messed up structure on save
Hope this will help 🙂 It is a bit hard to explain it cleaner.
1. Hitting save button will result in no hash for current language repeater data and hash added for all of the rest langs (if they are not just empty arrays).
2. This is true for both create and edit actions (when creating you traverse languages and fill the data, hit save, same will happen, current language will be without hash, all others will have)
3. Having a repeater for a lang or not, doesn't matter, because even if you don't have a repeater for a lang it is saved as empty array by default, so hashes are added for the rest of the languages.
4. Didn't found dependency with default language for the cases above.
5. Default language matters in one case - edit without repeater only in one language
By default editing on every language without repeater adds empty array as data. Saving in non default language, adds the default language automatically and assigns it empty array. (bg is default) like this:
{"en":[],"bg":[]}
But saving in default language without repeater adds empty string for don't know how picked language in that case 'de'. (every time when this occurs the string is for 'de' language)
{"bg":[],"de":""}
This is not a problem and maybe never will be. I've just noticed it. You can create a resource on default lang it will be {"bg":[]}
after creating just hit save and: {"bg":[],"de":""}
P.S. Some similar issue is happening to files inside the repeater. Sometimes they become:
"file":{"f56d1d23-f291-4166-9002-8101b2977e40":"01JBHD5YSK0NMAEP5BXHC9ABFA.pdf"}
but they should be:
"file":"01JBHD8PWFENG72F7XNABSJ061.pdf"
10 replies
Filament repeater translations messed up structure on save
Tomorrow will test more in depth, because it seems that the problem is not only on the first lang, nor the default one. And maybe there is something with the sequence of the actions on different language. Hope will find a patter and will write it here 🙂
10 replies
Filament repeater translations messed up structure on save
Yes, filament handles them. I've just noticed this when my client side throws an exception because of unprocessable data. Then I've found the change in the structure in the json column on save. I just didn't know if is this changes occuring for different languages are expected to happen. And if there is a problem or not.
So as it seems it is supposed to work this way. I appriciate your quick answer! Thank you!
10 replies
Cannot search by table columns with same name but one is from relation
Set searchable condition to relation table and column name (
customers.name
) works and search starts working. But this way there is again a bit strange thing.
select count(*) as aggregate from "properties" where (lower(json_extract(name, "$.en")) like '%Misho%' or exists (select * from "customers" where "properties"."customer_id" = "customers"."id" and "customers"."name" like '%Misho%') or exists (select * from "property_types" where "properties"."property_type_id" = "property_types"."id" and "property_types"."name" like '%Misho%')) and "properties"."deleted_at" is null
There are 3 columns:
- property name (which is json and is translatable)
- customer name (which is string and is not translatable)
- property type name (which is json and is translatable)
In the result sql above properties name is searched like a json but property type name part of the query does not use the json way by filament.
I don't know how I will unify the search everywhere easily because this different kind of queries will result in different type of search (uppercase, lowercase and etc) and will drive the users crazy.5 replies
Cannot search by table columns with same name but one is from relation
Sorry, I see your response just now.
It is very strange the result query on search is:
select * from
properties where (lower(json_extract(name, "$.en")) like '%saepe%' or lower(json_extract(name, "$.en")) like '%saepe%' or lower(json_extract(name, "$.en")) like '%saepe%') and
properties.
deleted_at is null order by
properties.
id asc limit 10 offset 0
When I remove the translatable column it starts working again. This is a bit disappointing 😦5 replies
Uploaded image not deleted on delete
What do you think, what is the proper solution of image is inserted in the editor, but the resource is not updated, so the observer is not fired, but the image is uploaded immediately when inserted in the editor no matter if the resource is saved/updated or not.
14 replies