Skip to content

Commit

Permalink
Merge pull request #441 from raziel057/fix-deprecation-xml-mapping
Browse files Browse the repository at this point in the history
Fix using XML mapping driver with XSD validation disabled is deprecated
  • Loading branch information
bartmcleod committed Aug 29, 2023
2 parents 58b77c4 + 1ba55ad commit 6bd4e3d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions DependencyInjection/LexikTranslationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Lexik\Bundle\TranslationBundle\DependencyInjection;

use Doctrine\ORM\Events;
use Doctrine\ORM\Mapping\Driver\SimplifiedXmlDriver;
use Lexik\Bundle\TranslationBundle\Manager\LocaleManagerInterface;
use Lexik\Bundle\TranslationBundle\Storage\StorageInterface;
use Symfony\Component\Config\FileLocator;
Expand Down Expand Up @@ -175,7 +176,11 @@ protected function buildTranslationStorageDefinition(ContainerBuilder $container
throw new \RuntimeException(sprintf('Unsupported storage "%s".', $storage));
}

$args[] = ['trans_unit' => new Parameter(sprintf('lexik_translation.%s.trans_unit.class', $storage)), 'translation' => new Parameter(sprintf('lexik_translation.%s.translation.class', $storage)), 'file' => new Parameter(sprintf('lexik_translation.%s.file.class', $storage))];
$args[] = [
'trans_unit' => new Parameter(sprintf('lexik_translation.%s.trans_unit.class', $storage)),
'translation' => new Parameter(sprintf('lexik_translation.%s.translation.class', $storage)),
'file' => new Parameter(sprintf('lexik_translation.%s.file.class', $storage))
];

$storageDefinition = new Definition();
$storageDefinition->setClass($container->getParameter(sprintf('lexik_translation.%s.translation_storage.class', $storage)));
Expand All @@ -193,7 +198,10 @@ protected function buildTranslationStorageDefinition(ContainerBuilder $container
*/
protected function createDoctrineMappingDriver(ContainerBuilder $container, $driverId, $driverClass)
{
$driverDefinition = new Definition($driverClass, [[realpath(__DIR__.'/../Resources/config/model') => 'Lexik\Bundle\TranslationBundle\Model']]);
$driverDefinition = new Definition($driverClass, [
[realpath(__DIR__.'/../Resources/config/model') => 'Lexik\Bundle\TranslationBundle\Model'],
SimplifiedXmlDriver::DEFAULT_FILE_EXTENSION, true
]);
$driverDefinition->setPublic(false);

$container->setDefinition($driverId, $driverDefinition);
Expand Down

0 comments on commit 6bd4e3d

Please sign in to comment.