public function onTranslatablePreFlush(TranslatableInterface $translatable, PreFlushEventArgs $event)
    {
        if (null === $config = $this->registry->findConfiguration($translatable, false)) {
            return;
        }

        $accessor = $this->getPropertyAccessor();

        foreach ($translatable->getTranslations() as $translation) {
            foreach ($config->getTranslationFields() as $field) {
                if (null !== $accessor->getValue($translation, $field)) {
                    continue 2;
                }
            }

            $translatable->removeTranslation($translation);
        }
    }
public function onTranslatablePreFlush(TranslatableInterface $translatable, PreFlushEventArgs $event)
    {
        if (null === $config = $this->registry->findConfiguration($translatable, false)) {
            return;
        }

        $accessor = $this->getPropertyAccessor();

        foreach ($translatable->getTranslations() as $translation) {
            foreach ($config->getTranslationFields() as $field) {
                if (null !== $accessor->getValue($translation, $field)) {
                    continue 2;
                }
            }

            $translatable->removeTranslation($translation);
        }
    }
public function onTranslatablePreFlush ( TranslatableInterface $ translatable , PreFlushEventArgs $ event ) { if ( null === $ config = $ this -> registry -> findConfiguration ( $ translatable , false ) ) { return ; } $ accessor = $ this -> getPropertyAccessor ( ) ; foreach ( $ translatable -> getTranslations ( ) as $ translation ) { foreach ( $ config -> getTranslationFields ( ) as $ field ) { if ( null !== $ accessor -> getValue ( $ translation , $ field ) ) { continue 2 ; } } $ translatable -> removeTranslation ( $ translation ) ; } }
Translatable pre flush event handler.

Removes translations when all 'content' fields are set to null.

@param TranslatableInterface $translatable
@param PreFlushEventArgs     $event
Translatable pre flush event handler .