override - Overriding FormType In symfony -
i have problem how overriding formtype in app in symfony2
my class
class contacttype extends abstracttype { public function buildform(formbuilderinterface $builder, array $options) { $builder ->add('firstname', 'text', array('label' => 'mremi_contact.form.first_name')) ->add('lastname', 'text', array('label' => 'mremi_contact.form.last_name')) ->add('email', 'email', array('label' => 'mremi_contact.form.email')); if ($subjects = $this->subjectprovider->getsubjects()) { $builder ->add('subject', 'choice', array( 'choices' => $subjects, 'label' => 'mremi_contact.form.subject', )); } else { $builder->add('subject', 'text', array('label' => 'mremi_contact.form.subject')); } $builder->add('message', 'textarea', array('label' => 'mremi_contact.form.message')); if ($this->captchatype) { $builder->add('captcha', $this->captchatype, array( 'label' => 'mremi_contact.form.captcha', 'mapped' => false, )); } $builder->add('save', 'submit', array('label' => 'mremi_contact.form_submit')); } public function getparent() { return 'mremi_contact'; } public function getname() { return 'mremi_contact_contact_custom'; } }
my services : mybundle\ressources\config\services.yml
services: mremi_contact.custom_contact.form.type: class: common\contactbundle\form\type\contacttype tags: - { name: form.type, alias: mremi_contact_contact_custom }
and declared in app/config
# mremi contactbundle mremi_contact: form: type: mremi_contact_contact_custom name: contact_form validation_groups: [default] subject_provider: mremi_contact.subject_provider.noop captcha_type: ewz_recaptcha email: mailer: mremi_contact.mailer.twig_swift from: [] to: - { address: thamer.nasri@gmail.com } template: mremicontactbundle:contact:email.txt.twig
the error not load type "mremi_contact_contact_custom" plz me thank
Comments
Post a Comment