Skip to content

Commit

Permalink
Remove direct dependencies on doctrine/common
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Moravec committed Jun 15, 2018
1 parent b560883 commit 4575736
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
"require": {
"php": "^7.1.3",
"ext-xml": "*",
"doctrine/common": "~2.4",
"doctrine/annotations": "~1.0",
"doctrine/cache": "~1.6",
"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",
Expand Down Expand Up @@ -86,11 +90,10 @@
},
"require-dev": {
"cache/integration-tests": "dev-master",
"doctrine/annotations": "~1.0",
"doctrine/cache": "~1.6",
"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",
Expand Down
13 changes: 11 additions & 2 deletions src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

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;
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
{
Expand Down Expand Up @@ -162,7 +162,7 @@ public function guessPattern($class, $property)
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];
Expand All @@ -179,4 +179,13 @@ protected function getMetadata($class)
}
}
}

private static function getRealClass(string $class) : string
{
if (false === $pos = strrpos($class, '\\' . Proxy::MARKER . '\\')) {
return $class;
}

return substr($class, $pos + Proxy::MARKER_LENGTH + 2);
}
}
11 changes: 8 additions & 3 deletions src/Symfony/Bridge/Doctrine/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@
],
"require": {
"php": "^7.1.3",
"doctrine/common": "~2.4",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-mbstring": "~1.0"
"symfony/polyfill-mbstring": "~1.0",
"doctrine/annotations": "~1.0",
"doctrine/cache": "~1.6",
"doctrine/collections": "~1.0",
"doctrine/event-manager": "~1.0",
"doctrine/persistence": "~1.0"
},
"require-dev": {
"symfony/stopwatch": "~3.4|~4.0",
Expand All @@ -35,7 +39,8 @@
"symfony/translation": "~3.4|~4.0",
"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",
Expand Down
1 change: 0 additions & 1 deletion src/Symfony/Component/Routing/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 4575736

Please sign in to comment.