Skip to content

Commit dc8b86b

Browse files
Merge branch '2.8' into 3.0
* 2.8: [Form] fix Catchable Fatal Error if choices is not an array [Process] Fix a transient test [Process] Fix potential race condition leading to transient tests [DoctrineBridge] [PropertyInfo] Catch Doctrine\ORM\Mapping\MappingException [Routing] removed unused variable in PhpMatcherDumperTest class. [travis] use github token to fetch deps from ZIP files [DependencyInjection] fixes typo in triggered deprecation notice. [Form] improve deprecation messages for the "empty_value" and "choice_list" options in the ChoiceType class. [Form] Fixed regression on Collection type add missing symfony/polyfill-php55 dependency Conflicts: src/Symfony/Component/DependencyInjection/SimpleXMLElement.php src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php src/Symfony/Component/HttpFoundation/composer.json
2 parents 96e684b + a1f65cd commit dc8b86b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

PropertyInfo/DoctrineExtractor.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Doctrine\Common\Persistence\Mapping\ClassMetadataFactory;
1515
use Doctrine\Common\Persistence\Mapping\MappingException;
1616
use Doctrine\ORM\Mapping\ClassMetadataInfo;
17+
use Doctrine\ORM\Mapping\MappingException as OrmMappingException;
1718
use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
1819
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
1920
use Symfony\Component\PropertyInfo\Type;
@@ -44,6 +45,8 @@ public function getProperties($class, array $context = array())
4445
$metadata = $this->classMetadataFactory->getMetadataFor($class);
4546
} catch (MappingException $exception) {
4647
return;
48+
} catch (OrmMappingException $exception) {
49+
return;
4750
}
4851

4952
return array_merge($metadata->getFieldNames(), $metadata->getAssociationNames());
@@ -58,6 +61,8 @@ public function getTypes($class, $property, array $context = array())
5861
$metadata = $this->classMetadataFactory->getMetadataFor($class);
5962
} catch (MappingException $exception) {
6063
return;
64+
} catch (OrmMappingException $exception) {
65+
return;
6166
}
6267

6368
if ($metadata->hasAssociation($property)) {

Tests/PropertyInfo/DoctrineExtractorTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,14 @@ public function typesProvider()
8181
array('notMapped', null),
8282
);
8383
}
84+
85+
public function testGetPropertiesCatchException()
86+
{
87+
$this->assertNull($this->extractor->getProperties('Not\Exist'));
88+
}
89+
90+
public function testGetTypesCatchException()
91+
{
92+
$this->assertNull($this->extractor->getTypes('Not\Exist', 'baz'));
93+
}
8494
}

0 commit comments

Comments
 (0)