Open aureliusm opened 10 years ago
Hi, am trying to do exactly the same. Baum has an issue with this, which you can read about here; https://github.com/dimsav/laravel-translatable/issues/25. Looks like Baum saves the data before the translations can be handed over. You probably saw that yoursef - did you ever find a solution to this?
Sorry for the late reply.
There's no bug/issue in Baum. This package just happens to hook on save events and perform several actions. Maybe we can find a way to make the packages compatible... What should be done differently for translatable to work?
thanks for getting back on this. I was rephrasing freekmurze calling it a "problem", no offense intended.
Freekmurzes fix (implement a service that calls up the translator before the saving event) from the same thread workes fine for me. It is, of course, a hack, My lack of skills regarding PHP preclude me from making any suggestions on how to find a better solution, though.
Again, thanks for your replies and work!
No worries. No offense taken ;).
It is indeed a problem, but it's just not a bug on neither package side. We just handle "saves" differently and Baum happens to freshen the model instance after saving so it keeps the Nested Set indices current (because the update operation when moving, operates on SQL level) and, because of that, there's nothing for translatable to save.
I've commented on this issue on the translatable project as well: dimsav/laravel-translatable#25. Maybe I can think of something to make the packages compatible.
Hi,
I am using baum on Page model (pages table) and dimsav Laravel Translations and have a problem, because I have a child table (page_translations) which has a foreign key in (pages.id). If I try to buildTree() with data including translations I get error "type":"ErrorException","message":"preg_replace(): Parameter mismatch, pattern is a string while replacement is an array","file":"C:\wamp\www\aurelius_angular\vendor\laravel\framework\src\Illuminate\Support\helpers.php","line":885
If I try to buildTree without translations, it works.
Thanks!