Skip to content

Commit

Permalink
minor #9427 adjust doctrine dependencies (Tobion)
Browse files Browse the repository at this point in the history
This PR was merged into the master branch.

Discussion
----------

adjust doctrine dependencies

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #9384, #9385
| License       | MIT
| Doc PR        | -

I went through all components/bundles/bridges in symfony and searched for doctrine dependencies. Then looked if it only requires a subset (annotations instead of common for example).

Commits
-------

7366901 adjust doctrine dependencies
  • Loading branch information
fabpot committed Nov 9, 2013
2 parents b8ec2bf + 7366901 commit b9b7c8a
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 46 deletions.
11 changes: 6 additions & 5 deletions src/Symfony/Bundle/FrameworkBundle/composer.json
Expand Up @@ -28,7 +28,7 @@
"symfony/stopwatch": "~2.3",
"symfony/templating": "~2.1",
"symfony/translation": "~2.3",
"doctrine/common": "~2.2"
"doctrine/annotations": "~1.0"
},
"require-dev": {
"symfony/finder": "~2.0",
Expand All @@ -38,10 +38,11 @@
"symfony/validator": "~2.1"
},
"suggest": {
"symfony/console": "",
"symfony/finder": "",
"symfony/form": "",
"symfony/validator": ""
"symfony/console": "For using the console commands",
"symfony/finder": "For using the translation loader and cache warmer",
"symfony/form": "For using forms",
"symfony/validator": "For using validation",
"doctrine/cache": "For using alternative cache drivers"
},
"autoload": {
"psr-0": { "Symfony\\Bundle\\FrameworkBundle\\": "" }
Expand Down
11 changes: 6 additions & 5 deletions src/Symfony/Component/Routing/composer.json
Expand Up @@ -2,7 +2,7 @@
"name": "symfony/routing",
"type": "library",
"description": "Symfony Routing Component",
"keywords": [],
"keywords": ["routing", "router", "URL", "URI"],
"homepage": "http://symfony.com",
"license": "MIT",
"authors": [
Expand All @@ -22,13 +22,14 @@
"symfony/config": "~2.2",
"symfony/yaml": "~2.0",
"symfony/expression-language": "~2.4",
"doctrine/common": "~2.2",
"doctrine/annotations": "~1.0",
"psr/log": "~1.0"
},
"suggest": {
"symfony/config": "",
"symfony/yaml": "",
"doctrine/common": ""
"symfony/config": "For using the all-in-one router or any loader",
"symfony/yaml": "For using the YAML loader",
"symfony/expression-language": "For using expression matching",
"doctrine/annotations": "For using the annotation loader"
},
"autoload": {
"psr-0": { "Symfony\\Component\\Routing\\": "" }
Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/Security/Acl/composer.json
Expand Up @@ -25,9 +25,9 @@
"psr/log": "~1.0"
},
"suggest": {
"symfony/class-loader": "",
"symfony/finder": "",
"doctrine/dbal": "to use the built-in ACL implementation"
"symfony/class-loader": "For using the ACL generateSql script",
"symfony/finder": "For using the ACL generateSql script",
"doctrine/dbal": "For using the built-in ACL implementation"
},
"autoload": {
"psr-0": { "Symfony\\Component\\Security\\Acl\\": "" }
Expand Down
5 changes: 3 additions & 2 deletions src/Symfony/Component/Security/Core/composer.json
Expand Up @@ -28,8 +28,9 @@
"suggest": {
"symfony/event-dispatcher": "",
"symfony/http-foundation": "",
"symfony/validator": "",
"ircmaxell/password-compat": ""
"symfony/validator": "For using the user password constraint",
"symfony/expression-language": "For using the expression voter",
"ircmaxell/password-compat": "For using the BCrypt password encoder in PHP <5.5"
},
"autoload": {
"psr-0": { "Symfony\\Component\\Security\\Core\\": "" }
Expand Down
Expand Up @@ -37,22 +37,21 @@ public function testHandleUnmatchedPath()
public function testHandleMatchedPathWithSuccessHandlerAndCsrfValidation()
{
$successHandler = $this->getSuccessHandler();
$csrfProvider = $this->getCsrfProvider();
$tokenManager = $this->getTokenManager();

list($listener, $context, $httpUtils, $options) = $this->getListener($successHandler, $csrfProvider);
list($listener, $context, $httpUtils, $options) = $this->getListener($successHandler, $tokenManager);

list($event, $request) = $this->getGetResponseEvent();

$request->query->set('_csrf_token', $csrfToken = 'token');
$request->query->set('_csrf_token', 'token');

$httpUtils->expects($this->once())
->method('checkRequestPath')
->with($request, $options['logout_path'])
->will($this->returnValue(true));

$csrfProvider->expects($this->once())
->method('isCsrfTokenValid')
->with('logout', $csrfToken)
$tokenManager->expects($this->once())
->method('isTokenValid')
->will($this->returnValue(true));

$successHandler->expects($this->once())
Expand Down Expand Up @@ -151,30 +150,29 @@ public function testSuccessHandlerReturnsNonResponse()
*/
public function testCsrfValidationFails()
{
$csrfProvider = $this->getCsrfProvider();
$tokenManager = $this->getTokenManager();

list($listener, $context, $httpUtils, $options) = $this->getListener(null, $csrfProvider);
list($listener, $context, $httpUtils, $options) = $this->getListener(null, $tokenManager);

list($event, $request) = $this->getGetResponseEvent();

$request->query->set('_csrf_token', $csrfToken = 'token');
$request->query->set('_csrf_token', 'token');

$httpUtils->expects($this->once())
->method('checkRequestPath')
->with($request, $options['logout_path'])
->will($this->returnValue(true));

$csrfProvider->expects($this->once())
->method('isCsrfTokenValid')
->with('logout', $csrfToken)
$tokenManager->expects($this->once())
->method('isTokenValid')
->will($this->returnValue(false));

$listener->handle($event);
}

private function getCsrfProvider()
private function getTokenManager()
{
return $this->getMock('Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface');
return $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface');
}

private function getContext()
Expand Down Expand Up @@ -209,7 +207,7 @@ private function getHttpUtils()
->getMock();
}

private function getListener($successHandler = null, $csrfProvider = null)
private function getListener($successHandler = null, $tokenManager = null)
{
$listener = new LogoutListener(
$context = $this->getContext(),
Expand All @@ -221,7 +219,7 @@ private function getListener($successHandler = null, $csrfProvider = null)
'logout_path' => '/logout',
'target_url' => '/',
),
$csrfProvider
$tokenManager
);

return array($listener, $context, $httpUtils, $options);
Expand Down
5 changes: 2 additions & 3 deletions src/Symfony/Component/Security/Http/composer.json
Expand Up @@ -23,14 +23,13 @@
"symfony/http-kernel": "~2.4"
},
"require-dev": {
"symfony/form": "~2.0",
"symfony/routing": "~2.2",
"symfony/security-csrf": "~2.4",
"psr/log": "~1.0"
},
"suggest": {
"symfony/security-csrf": "",
"symfony/routing": ""
"symfony/security-csrf": "For using tokens to protect authentication/logout attempts",
"symfony/routing": "For using the HttpUtils class to create sub-requests, redirect the user, and match URLs"
},
"autoload": {
"psr-0": { "Symfony\\Component\\Security\\Http\\": "" }
Expand Down
15 changes: 7 additions & 8 deletions src/Symfony/Component/Security/composer.json
Expand Up @@ -28,7 +28,6 @@
"symfony/security-http": "self.version"
},
"require-dev": {
"symfony/form": "~2.0",
"symfony/routing": "~2.2",
"symfony/validator": "~2.2",
"doctrine/common": "~2.2",
Expand All @@ -38,13 +37,13 @@
"symfony/expression-language": "~2.4"
},
"suggest": {
"symfony/class-loader": "",
"symfony/finder": "",
"symfony/form": "",
"symfony/validator": "",
"symfony/routing": "",
"doctrine/dbal": "to use the built-in ACL implementation",
"ircmaxell/password-compat": ""
"symfony/class-loader": "For using the ACL generateSql script",
"symfony/finder": "For using the ACL generateSql script",
"symfony/validator": "For using the user password constraint",
"symfony/routing": "For using the HttpUtils class to create sub-requests, redirect the user, and match URLs",
"doctrine/dbal": "For using the built-in ACL implementation",
"symfony/expression-language": "For using the expression voter",
"ircmaxell/password-compat": "For using the BCrypt password encoder in PHP <5.5"
},
"autoload": {
"psr-0": { "Symfony\\Component\\Security\\": "" }
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Validator/ValidatorBuilder.php
Expand Up @@ -205,8 +205,8 @@ public function enableAnnotationMapping(Reader $annotationReader = null)
}

if (null === $annotationReader) {
if (!class_exists('Doctrine\Common\Annotations\AnnotationReader')) {
throw new \RuntimeException('Requested a ValidatorFactory with an AnnotationLoader, but the AnnotationReader was not found. You should add Doctrine Common to your project.');
if (!class_exists('Doctrine\Common\Annotations\AnnotationReader') || !class_exists('Doctrine\Common\Cache\ArrayCache')) {
throw new \RuntimeException('Enabling annotation based constraint mapping requires the packages doctrine/annotations and doctrine/cache to be installed.');
}

$annotationReader = new CachedReader(new AnnotationReader(), new ArrayCache());
Expand Down
7 changes: 5 additions & 2 deletions src/Symfony/Component/Validator/composer.json
Expand Up @@ -24,10 +24,13 @@
"symfony/http-foundation": "~2.1",
"symfony/intl": "~2.3",
"symfony/yaml": "~2.0",
"symfony/config": "~2.2"
"symfony/config": "~2.2",
"doctrine/annotations": "~1.0",
"doctrine/cache": "~1.0"
},
"suggest": {
"doctrine/common": "",
"doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.",
"doctrine/cache": "For using the default cached annotation reader",
"symfony/http-foundation": "",
"symfony/intl": "",
"symfony/yaml": "",
Expand Down

0 comments on commit b9b7c8a

Please sign in to comment.