Поведение метки по умолчанию определено в FieldType
:
https://github.com/symfony/symfony/blob/2.0/src/Symfony/Component/Form/Extension/Core/Type/FieldType.php#L55
(примечание: класс FieldType устарел в Symfony 2.1 и удален в Symfony 2.3)
Если вы хотите изменить поведение типа по умолчанию, вы можете создать расширение:
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/AbstractTypeExtension.php
class FieldTypeEntityLabelExtension
{
static $currentTypeName;
public function buildForm(FormBuilder $builder, array $options)
{
$types = $builder->getTypes();
$type = end($types);
$dataClass = get_class($type);
if (strpos($dataClass, 'Uc') === 0) // <-- My namespace
{
$classParts = explode( '\\', $dataClass);
$translationParts = array_slice($classParts, 3);
self::$currentTypeName = implode('.', array_map('Symfony\Component\DependencyInjection\Container::underscore', $translationParts));
}
if (isset(self::$currentTypeName) && !$options['precious'])
{
$builder->setAttribute('label', sprintf('%s.%s', substr(self::$currentTypeName, 0, -5), $builder->getName()));
}
}
public function getExtendedType()
{
return 'field';
}
}