<table role="table">
<thead>
<tr>
<th>Q</th>
<th>A</th>
</tr>
</thead>
<tbody>
<tr>
<td>Bug report?</td>
<td>yes</td>
</tr>
<tr>
<td>Feature request?</td>
<td>no</td>
</tr>
<tr>
<td>BC Break report?</td>
<td>yes</td>
</tr>
<tr>
<td>RFC?</td>
<td>?</td>
</tr>
<tr>
<td>Symfony version</td>
<td>2.8.15</td>
</tr>
</tbody>
</table>
<p dir="auto">Hi,<br>
I'm upgrading from Symfony 2.3 to 2.8 and ran into an issue.<br>
I'm using an entity which get some properties let's see it as follow</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class MyEntity
{
    private $myProperty;
}"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-v">MyEntity</span>
{
    <span class="pl-k">private</span> <span class="pl-c1"><span class="pl-c1">$</span>myProperty</span>;
}</pre></div>
<p dir="auto">I'm missing annotations as this code it is only for demonstration purpose, but it is a symfony entity.<br>
I got a controller action which list MyEntity's entites and I got a filter system to show all my entites or only those with <code class="notranslate">$myProperty</code> corresponding to what I want.<br>
We can imagine the controller action as follow:</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function listAction(Request $request)
{
    $form = $this
        -&gt;createForm(MyEntityFormType::class, [], ['method' =&gt; $request-&gt;getMethod()])
        -&gt;handleRequest($request)
    ;
}"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">listAction</span>(<span class="pl-smi"><span class="pl-smi">Request</span></span> <span class="pl-s1"><span class="pl-c1">$</span>request</span>)
{
    <span class="pl-s1"><span class="pl-c1">$</span>form</span> = <span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>
        -&gt;<span class="pl-en">createForm</span>(<span class="pl-v">MyEntityFormType</span>::class, [], [<span class="pl-s">'method'</span> =&gt; <span class="pl-s1"><span class="pl-c1">$</span>request</span>-&gt;<span class="pl-en">getMethod</span>()])
        -&gt;<span class="pl-en">handleRequest</span>(<span class="pl-s1"><span class="pl-c1">$</span>request</span>)
    ;
}</pre></div>
<p dir="auto">In <code class="notranslate">symfony/symfony/src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationRequestHandler::handleRequest()</code> function there is in line 109 this verification:</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// Don't auto-submit the form unless at least one field is present.
if ('' === $name &amp;&amp; count(array_intersect_key($data, $form-&gt;all())) &lt;= 0) {
    return;
}"><pre class="notranslate"><span class="pl-c">// Don't auto-submit the form unless at least one field is present.</span>
<span class="pl-k">if</span> (<span class="pl-s">''</span> === <span class="pl-s1"><span class="pl-c1">$</span>name</span> &amp;&amp; count(array_intersect_key(<span class="pl-s1"><span class="pl-c1">$</span>data</span>, <span class="pl-s1"><span class="pl-c1">$</span>form</span>-&gt;<span class="pl-en">all</span>())) &lt;= <span class="pl-c1">0</span>) {
    <span class="pl-k">return</span>;
}</pre></div>
<p dir="auto">I never have form name in sent data on my whole project. When I try to call my controller action <code class="notranslate">listAction</code> without filtering on <code class="notranslate">MyEntity::myProperty</code> form is not submitted because no field are present in form while I could before as I was using <code class="notranslate">submit()</code> function.</p>
<p dir="auto">I found a workaround checking if I'm in this particular case and then resubmitting manually the form but it's kind of ugly and definitly not a good practice.</p>
<div class="highlight highlight-text-html-php notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$form = $this
    -&gt;createForm(MyEntityFormType::class, [], ['method' =&gt; $request-&gt;getMethod()])
    -&gt;handleRequest($request)
;

// $form-&gt;handleRequest() doesn't submit request with no data
// If the form doesn't get errors and the request doesn't get
// data we manually call $form-&gt;submit() w/ computed data
if (!$form-&gt;isSubmitted() &amp;&amp; (0 === count($form-&gt;getErrors(true))) &amp;&amp; $form-&gt;isEmpty()) {
    $requestData = $request-&gt;request-&gt;all();
    $queryData = $request-&gt;query-&gt;all();
    $form-&gt;submit(array_merge($defaultValue, $queryData, $requestData));
}"><pre class="notranslate"><span class="pl-s1"><span class="pl-c1">$</span>form</span> = <span class="pl-s1"><span class="pl-c1">$</span><span class="pl-smi">this</span></span>
    -&gt;<span class="pl-en">createForm</span>(<span class="pl-v">MyEntityFormType</span>::class, [], [<span class="pl-s">'method'</span> =&gt; <span class="pl-s1"><span class="pl-c1">$</span>request</span>-&gt;<span class="pl-en">getMethod</span>()])
    -&gt;<span class="pl-en">handleRequest</span>(<span class="pl-s1"><span class="pl-c1">$</span>request</span>)
;

<span class="pl-c">// $form-&gt;handleRequest() doesn't submit request with no data</span>
<span class="pl-c">// If the form doesn't get errors and the request doesn't get</span>
<span class="pl-c">// data we manually call $form-&gt;submit() w/ computed data</span>
<span class="pl-k">if</span> (!<span class="pl-s1"><span class="pl-c1">$</span>form</span>-&gt;<span class="pl-en">isSubmitted</span>() &amp;&amp; (<span class="pl-c1">0</span> === count(<span class="pl-s1"><span class="pl-c1">$</span>form</span>-&gt;<span class="pl-en">getErrors</span>(<span class="pl-c1">true</span>))) &amp;&amp; <span class="pl-s1"><span class="pl-c1">$</span>form</span>-&gt;<span class="pl-en">isEmpty</span>()) {
    <span class="pl-s1"><span class="pl-c1">$</span>requestData</span> = <span class="pl-s1"><span class="pl-c1">$</span>request</span>-&gt;<span class="pl-c1">request</span>-&gt;<span class="pl-en">all</span>();
    <span class="pl-s1"><span class="pl-c1">$</span>queryData</span> = <span class="pl-s1"><span class="pl-c1">$</span>request</span>-&gt;<span class="pl-c1">query</span>-&gt;<span class="pl-en">all</span>();
    <span class="pl-s1"><span class="pl-c1">$</span>form</span>-&gt;<span class="pl-en">submit</span>(array_merge(<span class="pl-s1"><span class="pl-c1">$</span>defaultValue</span>, <span class="pl-s1"><span class="pl-c1">$</span>queryData</span>, <span class="pl-s1"><span class="pl-c1">$</span>requestData</span>));
}</pre></div>
<p dir="auto">Is there a best practice to handle this case ?<br>
Is this a case which is not supposed to be ?</p>
<p dir="auto">Hello,</p>
<p dir="auto">I was trying to set my dbal connection using doctrine with MySQL PDO. When setting the yaml config file to use password '@SomePassword01' the framework will expect an object reference rather than a string.<br>
This causes an exception: InvalidTypeException: Invalid type for path "doctrine.dbal.connections.default.password". Expected scalar, but got object.</p>
<p dir="auto">Can you please have a look?<br>
If this won't be fixed can you please at least make sure than the password requirement are mentioned correctly.</p>
<p dir="auto">Using standard installation 2.2.0<br>
MySQL Server 5.6<br>
PHP 5.4.12</p>