Skip to content

Commit 18b36d2

Browse files
Merge branch '3.0'
* 3.0: (105 commits) [Console] remove readline support bumped Symfony version to 3.0.3 updated VERSION for 3.0.2 updated CHANGELOG for 3.0.2 [Routing] added a suggestion to add the HttpFoundation component. [FrameworkBundle] fix assets and templating tests [ClassLoader] fix ApcClassLoader tests on HHVM [travis] Add some comments changed operator from and to && [DependencyInjection] Remove unused parameter [Process] Fix transient tests for incremental outputs [Console] Add missing `@require` annotation in test Fix merge [appveyor] Fix failure reporting [#17634] move DebugBundle license file Limit Ldap component version for the 3.0 branch backport GlobTest from 2.7 branch Move licenses according to new best practices [FrameworkBundle] Remove unused code in test [2.3] Fixed an undefined variable in Glob::toRegex ... Conflicts: .travis.yml composer.json src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/assets.php src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/assets.xml src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets.yml src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig src/Symfony/Component/Console/CHANGELOG.md src/Symfony/Component/HttpKernel/Kernel.php src/Symfony/Component/PropertyInfo/Tests/PropertyInfoExtractorTest.php src/Symfony/Component/Yaml/Tests/ParserTest.php
2 parents 007fe0a + f55fd78 commit 18b36d2

File tree

5 files changed

+5
-40
lines changed

5 files changed

+5
-40
lines changed

DependencyInjection/AbstractDoctrineExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ protected function setMappingDriverConfig(array $mappingConfig, $mappingName)
153153
*/
154154
protected function getMappingDriverBundleConfigDefaults(array $bundleConfig, \ReflectionClass $bundle, ContainerBuilder $container)
155155
{
156-
$bundleDir = dirname($bundle->getFilename());
156+
$bundleDir = dirname($bundle->getFileName());
157157

158158
if (!$bundleConfig['type']) {
159159
$bundleConfig['type'] = $this->detectMetadataDriver($bundleDir, $container);

DependencyInjection/CompilerPass/DoctrineValidationPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private function updateValidatorMappingFiles(ContainerBuilder $container, $mappi
6060

6161
foreach ($container->getParameter('kernel.bundles') as $bundle) {
6262
$reflection = new \ReflectionClass($bundle);
63-
if (is_file($file = dirname($reflection->getFilename()).'/'.$validationPath)) {
63+
if (is_file($file = dirname($reflection->getFileName()).'/'.$validationPath)) {
6464
$files[] = realpath($file);
6565
$container->addResource(new FileResource($file));
6666
}

Tests/PropertyInfo/DoctrineExtractorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DoctrineExtractorTest extends \PHPUnit_Framework_TestCase
2626
*/
2727
private $extractor;
2828

29-
public function setUp()
29+
protected function setUp()
3030
{
3131
$config = Setup::createAnnotationMetadataConfiguration(array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'), true);
3232
$entityManager = EntityManager::create(array('driver' => 'pdo_sqlite'), $config);

Tests/Validator/Constraints/UniqueEntityValidatorTest.php

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Doctrine\Common\Persistence\ObjectManager;
1717
use Doctrine\Common\Persistence\ObjectRepository;
1818
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
19-
use Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity;
2019
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity;
2120
use Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleNameEntity;
2221
use Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity;
@@ -402,8 +401,8 @@ public function testAssociatedEntity()
402401

403402
$this->buildViolation('myMessage')
404403
->atPath('property.path.single')
405-
->setParameter('{{ value }}', 1)
406-
->setInvalidValue(1)
404+
->setParameter('{{ value }}', $entity1)
405+
->setInvalidValue($entity1)
407406
->assertRaised();
408407
}
409408

@@ -427,29 +426,6 @@ public function testAssociatedEntityWithNull()
427426
$this->assertNoViolation();
428427
}
429428

430-
/**
431-
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
432-
* @expectedExceptionMessage Associated entities are not allowed to have more than one identifier field
433-
*/
434-
public function testAssociatedCompositeEntity()
435-
{
436-
$constraint = new UniqueEntity(array(
437-
'message' => 'myMessage',
438-
'fields' => array('composite'),
439-
'em' => self::EM_NAME,
440-
));
441-
442-
$composite = new CompositeIntIdEntity(1, 1, 'test');
443-
$associated = new AssociationEntity();
444-
$associated->composite = $composite;
445-
446-
$this->em->persist($composite);
447-
$this->em->persist($associated);
448-
$this->em->flush();
449-
450-
$this->validator->validate($associated, $constraint);
451-
}
452-
453429
/**
454430
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
455431
* @expectedExceptionMessage Object manager "foo" does not exist.

Validator/Constraints/UniqueEntityValidator.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,6 @@ public function validate($entity, Constraint $constraint)
9696
* getter methods in the Proxy are being bypassed.
9797
*/
9898
$em->initializeObject($criteria[$fieldName]);
99-
100-
$relatedClass = $em->getClassMetadata($class->getAssociationTargetClass($fieldName));
101-
$relatedId = $relatedClass->getIdentifierValues($criteria[$fieldName]);
102-
103-
if (count($relatedId) > 1) {
104-
throw new ConstraintDefinitionException(
105-
'Associated entities are not allowed to have more than one identifier field to be '.
106-
'part of a unique constraint in: '.$class->getName().'#'.$fieldName
107-
);
108-
}
109-
$criteria[$fieldName] = array_pop($relatedId);
11099
}
111100
}
112101

0 commit comments

Comments
 (0)