<p dir="auto">We seem to be having an issue with the validator service when using collections and the validator to check for unique entities.</p>
<p dir="auto">The validator will correctly find any issues before persisting the entity to the doctrine manager.</p>
<p dir="auto">The validator seems to check the data in the current database but doesn't check the data that is going to be saved.</p>
<p dir="auto">For instance if title is a unique entity and in my collection I am adding two new collections to the database both with the title abc it will not throw an error with the validator but will try to add them both causing an internal server error.</p>
<p dir="auto">We are adding clientside checks but wasn't sure if this was a bug in the validator service.</p>
<table role="table">
<thead>
<tr>
<th>Q</th>
<th>A</th>
</tr>
</thead>
<tbody>
<tr>
<td>Bug report?</td>
<td>no</td>
</tr>
<tr>
<td>Feature request?</td>
<td>yes</td>
</tr>
<tr>
<td>BC Break report?</td>
<td>no</td>
</tr>
<tr>
<td>RFC?</td>
<td>yes</td>
</tr>
<tr>
<td>Symfony version</td>
<td>3.x (maybe 2.x and 4.x also?)</td>
</tr>
</tbody>
</table>
<p dir="auto">I am debugging a custom CMS made with Symfony (3.x) using Blackfire, in order to improve the performance as much as possible (and learn!). I already removed all heavy constructor services (Doctrine, Twig/Templating) from event listeners/subscribers, but there is one which I can't (or maybe shouldn't) remove, since it's in core. I am talking about Symfony\Component\HttpKernel\EventListener\TranslatorListener, which has "translator" service as dependency, and that service has a heavy constructor. It takes ~10% of the time in my current best case scenario.</p>
<p dir="auto">I was looking for some issue similar to this, to no create a duplicate, I found some others about improve it (i.e. limiting some loaders/dumpers), but I didn't find any issue about lazy-loading that service (or its heavy logic) to avoid its construction at all unless required.</p>