在Symfony中使用OneToMany和ManyToOne映射而不是选择文本输入

How to set text input in form instead of select (choice) which is automatically generated in Symfony when I'm using ManyToOne and OneToMany mapping? I would like to be able to fill input field manually and not select it from the list. Is it possible to set is like this and then change somehow the mapping?

$form = $this->createFormBuilder(new Record())
    ->add('foreign_id', 'text')
    ->add('save', 'submit')
    ->getForm();

You must use a Symfony Form Transformer, when can transform object to scalar or another data for view in input (textfield for example), and reverse transformation for load object from scalar value.

For more information please see: http://symfony.com/doc/current/cookbook/form/data_transformers.html

UPD: the field can be any type, if you use data transformer for this field.