<p dir="auto">In <code class="notranslate">dev</code> environment we're using a custom email constraint validator that's being created by decorating the shipped email constraint validator:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    app.dev.validator.email:
        class: AppBundle\Validator\DevelopmentEmailValidator
        public: false
        decorates: validator.email
        arguments: [&quot;@app.dev.validator.email.inner&quot;]"><pre class="notranslate"><code class="notranslate">    app.dev.validator.email:
        class: AppBundle\Validator\DevelopmentEmailValidator
        public: false
        decorates: validator.email
        arguments: ["@app.dev.validator.email.inner"]
</code></pre></div>
<p dir="auto">After updating to 3.1.5 we're running into problems with the missing class <code class="notranslate">InvalidArgumentException</code> because it enters the <code class="notranslate">$definition-&gt;isPublic()</code> if in line 33 of <code class="notranslate">AddConstraintValidatorsPass.php</code>. That has been fixed with commit <a href="https://github.com/symfony/symfony/commit/32451b1a092181b793ee6bd186eeb7a3ca039491">#32451b1a092181b793ee6bd186eeb7a3ca039491</a>. But the underlying problem still persists. Due to the service decoration the <code class="notranslate">$definition-&gt;isPublic()</code>-check fails on the <code class="notranslate">app.dev.validator.email.inner</code> service.</p>
<p dir="auto">Don't know whether this is the expected behavior. If so, what would be the <em>new</em> way to replace shipped constraint validators?</p>
<p dir="auto">Hi.<br>
I have a decorator for doctrine.orm.validator.unique which is tagged with validator.constraint_validator. With symfony 3.1.5 new checks were introduced in <a href="https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddConstraintValidatorsPass.php">here</a></p>
<p dir="auto">My decorator:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    app.decorating.doctrine_unique:
        class:     CapiBundle\Model\Validator\Constraints\UniqueEntityDecorator
        decorates: doctrine.orm.validator.unique
        arguments: ['@app.decorating.doctrine_unique.inner', '@doctrine']
        public:    false"><pre class="notranslate"><code class="notranslate">    app.decorating.doctrine_unique:
        class:     CapiBundle\Model\Validator\Constraints\UniqueEntityDecorator
        decorates: doctrine.orm.validator.unique
        arguments: ['@app.decorating.doctrine_unique.inner', '@doctrine']
        public:    false
</code></pre></div>
<p dir="auto">results with exception <code class="notranslate">The service "app.decorating.doctrine_unique.inner" must be public as it can be lazy-loaded.</code><br>
Additionaly, <code class="notranslate">InvalidArgumentException</code> is not imported.</p>