How to remove only one translation in CakePHP's TranslateBehavior?
I have a model with TranslateBehavior attached to it and I wonder if there is a method to remove only one translation of specific item and use only standard model methods (=not provide SQL query on i18n table explicitly, because I want to be absolutely independent of DB engine) and not set it blank but really remove.
Simple situation example:
There is an article in DB with translations in English and German. One day editor decides not to provi开发者_运维问答de this article in German and wants to remove it from DB (but English version should be still available). And now appears the question I wrote above.Thank you in advance for your help.
As for now after examining afterSave callback in the behavior class I see only some kind of workaround - to use the core model I18nModel defined in cake/libs/model/behavior/translate.php (bottom of the file) and use delete method with manually set all conditions that normally are set by translateBehavior.
The I18nModel model can be used in standard way:
var $uses = array('SomeModelUsingTranlateBehaviour','I18nModel');
精彩评论