bug #31336 [DoctrineBridge] do not choke on not existing mapping field (xabbuh)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[DoctrineBridge] do not choke on not existing mapping field

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | 31239
| License       | MIT
| Doc PR        |

Commits
-------

9a9134f4e4 do not choke on not existing mapping field
This commit is contained in:
Fabien Potencier 2019-05-01 07:58:19 +02:00
commit 51ff98ebbc
3 changed files with 4 additions and 1 deletions

View File

@ -17,6 +17,8 @@ class BaseUser
*/
private $username;
private $enabled;
/**
* BaseUser constructor.
*

View File

@ -6,6 +6,7 @@
<mapped-superclass name="Symfony\Bridge\Doctrine\Tests\Fixtures\BaseUser">
<field name="username" column="username" type="string" length="120" />
<field name="enabled" type="boolean" />
</mapped-superclass>
</doctrine-mapping>

View File

@ -72,7 +72,7 @@ final class DoctrineLoader implements LoaderInterface
$metadata->addConstraint(new UniqueEntity(['fields' => $mapping['fieldName']]));
}
if (null === $mapping['length']) {
if (null === ($mapping['length'] ?? null)) {
continue;
}