Closed ldecoker closed 2 years ago
HI, I have the same issue. I found a workaround by redefining the TranslationMethodsTrait::isEmpty method from KnpLabs/DoctrineBehaviors
trait FixValidationTranslationTrait
{
public function isEmpty(): bool
{
return false;
}
}
And in my translation class
use Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface;
use Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait;
class ServiceTranslation implements TranslationInterface
{
use FixValidationTranslationTrait {
FixValidationTranslationTrait::isEmpty insteadof TranslationTrait;
}
use TranslationTrait;
[...]
}
In my particular case it works ;-)
Jérôme
Hello @jerome-fix !
Thx for this! I apply it and indeed it works but only when creating new object. When I edit it and remove the content of one mandatory field, it crashed. Was it the same for you?
What is supposed to do the isEmpty function?
thx!
Hello!
I am using a2lix translation form (3.0.7) with doctrine behavior (2.2.0). I managed to get the translated entities validated (using validation in yaml file) but this only works when at least one field in each language is populated. If for example you have 2 required languages and you add informations for one and leave all fields for second mandatory language empty, this will not generate a validation error. Any idea on how to fix that? Thx!