Remove direct dependencies on doctrine/common

This commit is contained in:
Michael Moravec 2018-06-15 02:15:56 +02:00
parent 6c03064cb6
commit b0fa398187
No known key found for this signature in database
GPG Key ID: 946F139F96C1C1B5
4 changed files with 22 additions and 6 deletions

View File

@ -18,7 +18,9 @@
"require": {
"php": "^7.1.3",
"ext-xml": "*",
"doctrine/common": "~2.4",
"doctrine/collections": "~1.0",
"doctrine/event-manager": "~1.0",
"doctrine/persistence": "~1.0",
"fig/link-util": "^1.0",
"twig/twig": "^1.35|^2.4.4",
"psr/cache": "~1.0",
@ -91,6 +93,7 @@
"doctrine/data-fixtures": "1.0.*",
"doctrine/dbal": "~2.4",
"doctrine/orm": "~2.4,>=2.4.5",
"doctrine/reflection": "~1.0",
"doctrine/doctrine-bundle": "~1.4",
"monolog/monolog": "~1.11",
"ocramius/proxy-manager": "~0.4|~1.0|~2.0",

View File

@ -13,6 +13,7 @@ namespace Symfony\Bridge\Doctrine\Form;
use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\Common\Persistence\Mapping\MappingException;
use Doctrine\Common\Persistence\Proxy;
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\MappingException as LegacyMappingException;
@ -20,7 +21,6 @@ use Symfony\Component\Form\FormTypeGuesserInterface;
use Symfony\Component\Form\Guess\Guess;
use Symfony\Component\Form\Guess\TypeGuess;
use Symfony\Component\Form\Guess\ValueGuess;
use Doctrine\Common\Util\ClassUtils;
class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
{
@ -162,7 +162,7 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
protected function getMetadata($class)
{
// normalize class name
$class = ClassUtils::getRealClass(ltrim($class, '\\'));
$class = self::getRealClass(ltrim($class, '\\'));
if (array_key_exists($class, $this->cache)) {
return $this->cache[$class];
@ -179,4 +179,13 @@ class DoctrineOrmTypeGuesser implements FormTypeGuesserInterface
}
}
}
private static function getRealClass(string $class): string
{
if (false === $pos = strrpos($class, '\\'.Proxy::MARKER.'\\')) {
return $class;
}
return substr($class, $pos + Proxy::MARKER_LENGTH + 2);
}
}

View File

@ -17,7 +17,9 @@
],
"require": {
"php": "^7.1.3",
"doctrine/common": "~2.4",
"doctrine/collections": "~1.0",
"doctrine/event-manager": "~1.0",
"doctrine/persistence": "~1.0",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-mbstring": "~1.0"
},
@ -33,9 +35,12 @@
"symfony/expression-language": "~3.4|~4.0",
"symfony/validator": "~3.4|~4.0",
"symfony/translation": "~3.4|~4.0",
"doctrine/annotations": "~1.0",
"doctrine/cache": "~1.6",
"doctrine/data-fixtures": "1.0.*",
"doctrine/dbal": "~2.4",
"doctrine/orm": "^2.4.5"
"doctrine/orm": "^2.4.5",
"doctrine/reflection": "~1.0"
},
"conflict": {
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0",

View File

@ -25,7 +25,6 @@
"symfony/expression-language": "~3.4|~4.0",
"symfony/dependency-injection": "~3.4|~4.0",
"doctrine/annotations": "~1.0",
"doctrine/common": "~2.2",
"psr/log": "~1.0"
},
"conflict": {