0
使用作曲家更新後,我的表單上出現此問題。作曲家更新後出現表格錯誤
[2017-06-26 10:35:26] MicroCMS.CRITICAL: Symfony\Component\Form\Exception\UnexpectedTypeException: Expected argument of type "string", "MicroCMS\Form\Type\NewsletterType" given (uncaught exception) at S:\wamp\www\silex\vendor\symfony\form\FormFactory.php line 55 {"exception":"[object] (Symfony\\Component\\Form\\Exception\\UnexpectedTypeException(code: 0): Expected argument of type \"string\", \"MicroCMS\\Form\\Type\\NewsletterType\" given at S:\\wamp\\www\\silex\\vendor\\symfony\\form\\FormFactory.php:55)"} []
他問我一個字符串,而它是一個他需要的對象。
我把表格的代碼,我有所有相同的問題:
<?php
namespace MicroCMS\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Validator\Constraints as Assert;
class NewsletterType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder->add('email', EmailType::class, [
'label' => '',
'required' => true,
'attr' => ['autocomplete' => 'off'],
'constraints' => new Assert\Email(['checkMX' => true]),
]);
}
public function getName() {
return 'newsletter';
}
}
謝謝您的幫助。