<p dir="auto">Hi,</p>
<p dir="auto">I have created HiddenEntityType (<a href="https://gist.github.com/kl3ryk/5781916">https://gist.github.com/kl3ryk/5781916</a>), to transform value of hidden field into Entity. I was using FormBuilderInterface::getParent() to get Entity class. But in Symfony 2.3 function FormBuilderInterface::getParent was removed. So is there any way to retreive parent form data_class name (<a href="https://gist.github.com/kl3ryk/5781916#file-hiddenentitytype-php-L36">https://gist.github.com/kl3ryk/5781916#file-hiddenentitytype-php-L36</a>)?</p>
<p dir="auto">Hi,</p>
<p dir="auto">I thought about a new type of field type which can solve several problems i met on the user group.</p>
<p dir="auto">The idea is to create an "hidden_entity" type which is just an hidden id in the form, and an entity fetched in the database by the DataTransformer. Here are two example of use:</p>
<h1 dir="auto">The transport entity case</h1>
<p dir="auto">Imagine you have a comment which should be attached to an article. In the page, you'll maybe have your form posting to a special URL like /addComment/{article_id}, and then fetch back the article from the URL.</p>
<p dir="auto">With hidden_entity, this would be way simplied since you'd just have to put the following on your comment form:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$builder-&gt;add('article', 'hidden_entity');"><pre class="notranslate"><span class="pl-s1">$builder</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span><span class="pl-en">add</span><span class="pl-kos">(</span><span class="pl-s">'article'</span><span class="pl-kos">,</span> <span class="pl-s">'hidden_entity'</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">And populate if from the controller when rendering the form:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$comment-&gt;setArticle($current_viewing_article);
$form = $this-&gt;createForm(new CommentType(), $comment);"><pre class="notranslate"><span class="pl-s1">$comment</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span><span class="pl-en">setArticle</span><span class="pl-kos">(</span><span class="pl-s1">$current_viewing_article</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-s1">$form</span> <span class="pl-c1">=</span> <span class="pl-s1">$this</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span><span class="pl-en">createForm</span><span class="pl-kos">(</span><span class="pl-k">new</span> <span class="pl-v">CommentType</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-s1">$comment</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<h1 dir="auto">The "JS-UI" case</h1>
<p dir="auto">Just imagine you want your user to select something among a <em>very</em> large set of data, like a city, and use some complex JavaScript UI like autocompletion, dynamic map etc. The current symfony's entity will generate a  containing the whole entries from the database, which is not acceptable in this case.
Using hidden_entity, you can easily add an hidden id to your form and your free to do whatever you want to fill it.
Hoping for feedbacks about this idea, I already wrote a prototype of this : https://github.com/Gregwar/FormBundle</p>