forms - Symfony "Could not load type" service yaml -
i tried create service in symfony 2.2 1 of form :
service.yml:
tyg_user.settings.form: class: symfony\component\form\form factory_method: createnamed factory_service: form.factory arguments: - tyg_user_settings - tyg_user_settings_name tyg_user.settings.form.type: class: tyg\userbundle\form\settings\settingsformtype tags: - { name: form.type, alias: tyg_user_settings } tyg_user.settings.form.handler: class: tyg\userbundle\form\settings\settingsformhandler scope: request arguments: - @tyg_user.settings.form - @request - @fos_user.user_manager
settingsform.php
<?php namespace tyg\userbundle\form\settings; use symfony\component\form\formbuilderinterface formbuilder;; use symfony\component\form\abstracttype; class settingsform extends abstracttype { public function buildform(formbuilder $builder, array $options) { $builder ->add('birthday', 'birthday') ->add('email', 'email') ->add('showmail') ->add('showbirthday') ; } public function getname() { return 'tyg_user_settings'; } } ?>
but error occuered :
could not load type "tyg_user_settings_name
this occurs when form through service container :
$this->container->get('tyg_user.settings.form');
i used create service through xml format when change yml format can't figure out how to make works
the tyg_user_settings_name
referencing form type alias.
if wanting reference parameter should use %tyg_user_settings_name%
instead.
Comments
Post a Comment