Reputation: 1985
When trying to load view, Symfony Profiler says:
Could not load type "datetime"
I use default builder:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name')
->add('dateCreated', 'datetime')
->add('dateModified', 'datetime')
;
}
How to create time fields and load view with no error?
Upvotes: 1
Views: 216
Reputation: 160
In symfony 3.0
Replace
'datetime'
With
\Symfony\Component\Form\Extension\Core\Type\DateTimeType::class
You can import the namespace
Upvotes: 1
Reputation: 39460
The fully qualified class name is required since Symfony 3.0:
$builder->add('dateCreated', DatetimeType::class);
$builder->add('dateModified', DatetimeType::class);
Hope this help
Upvotes: 1