minor #27012 [DoctrineBridge] Improve exception message at IdReader::getIdValue() (phansys)

This PR was merged into the 2.7 branch.

Discussion
----------

[DoctrineBridge] Improve exception message at `IdReader::getIdValue()`

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

Commits
-------

5e98478d94 [DoctrineBridge] Improve exception message at `IdReader::getIdValue()`
This commit is contained in:
Fabien Potencier 2018-04-23 11:30:02 +02:00
commit 45f26c416a

View File

@ -95,10 +95,7 @@ class IdReader
}
if (!$this->om->contains($object)) {
throw new RuntimeException(
'Entities passed to the choice field must be managed. Maybe '.
'persist them in the entity manager?'
);
throw new RuntimeException(sprintf('Entity of type "%s" passed to the choice field must be managed. Maybe you forget to persist it in the entity manager?', get_class($object)));
}
$this->om->initializeObject($object);