我无法完成resettingFrom覆盖。虽然我为registrationForm做了。这是我的相关文件:
services.yml:
mycars_frontend.resetting.form.type:
class: Mycars\Website\FrontendBundle\Form\Type\ResettingFormType
arguments: [%fos_user.model.user.class%]
tags:
- { name: form.type, alias: mycars_frontend_resetting }
resettingFormType.php:
namespace Mycars\Website\FrontendBundle\Form\Type;
use Symfony\Component\Form\FormBuilderInterface;
use FOS\UserBundle\Form\Type\ResettingFormType as AbstractType;
class ResettingFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->add('City');
}
public function getName()
{
return 'mycars_frontend_resetting';
}
}
config.yml:
fos_user:
db_driver: orm
firewall_name: main
user_class: Mycars\Website\FrontendBundle\Entity\Customer
registration:
form:
type: mycars_frontend_registration
resetting:
form:
type: mycars_frontend_resetting
Customer.php
namespace Mycars\Website\FrontendBundle\Entity;
use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* Mycars\Website\FrontendBundle\Entity\Customer
*
* @ORM\Entity(repositoryClass="CustomerRepository")
* @ORM\Table(name="Customer")
*/
class Customer extends BaseUser
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=32, nullable=true)
*/
protected $Civilite;
/**
* @ORM\Column(type="string", length=32, nullable=true)
*/
protected $Firstname;
/**
* @ORM\Column(type="string", length=32, nullable=true)
*/
protected $Lastname;
/**
* @ORM\Column(type="string", length=32, nullable=true)
*/
protected $Phone;
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $Address1;
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $Address2;
/**
* @ORM\Column(type="string", length=5, nullable=true)
*/
protected $Zipcode;
/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
protected $City;
我没有错误,只是普通的个人资料编辑表格.. 谢谢!
答案 0 :(得分:3)
在您的服务定义中,您有一个拼写错误:
mycars_frontend.resetting.form.type:
但它应该是:
mycars_frontend_resetting.form.type:
我在“frontend”和“resetting”之间用下划线(_)替换了一个点(。)。
答案 1 :(得分:0)
我认为您可能需要覆盖ResettingController并指定要使用的表单。