Skip to content

TransUnitRepository::getAllDomainByLocale problem #423

@web-fu

Description

@web-fu

I was trying to refresh the cache via console and I received this error:

Argument 3 passed to Symfony\Bundle\FrameworkBundle\Translation\Translator::addResource() must be of the type string, null given, called in vendor/lexik/translation-bundle/Translation/Translator.php on line 44

After many attempts and some debug, I discovered the problem is caused by this query:

public function getAllDomainsByLocale()
{
    return $this->createQueryBuilder('tu')
        ->select('te.locale, tu.domain')
        ->leftJoin('tu.translations', 'te')
        ->addGroupBy('te.locale')
        ->addGroupBy('tu.domain')
        ->getQuery()
        ->getArrayResult();
}

If the locale column contains any null value the error is triggered.

I don't know if the problem is the leftJoin (maybe should be a normal join) or addResource signature (maybe should accept also null values).

For now I removed the invalid translation_unit rows that caused the problem.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions