symfony - Form as service not working -


i have problem load form service in symfony 3.2 created custom field as:

class imagetype extends abstracttype {     private $path;      /**      * imagetype constructor.      */     public function __construct($path)     {         $this->path = $path;     }      /**      * @return string      */     public function getparent()     {         return filetype::class;     }      /**      * @return string      */     public function getname()     {         return 'image';     }      /**      * @param optionsresolver $resolver      */     public function configureoptions(optionsresolver $resolver)     {         $resolver->setdefaults(array(             'image_name' => ''         ));     }      /**      * @param formview $view      * @param forminterface $form      * @param array $options      */     public function buildview(formview $view, forminterface $form, array $options)     {         $view->vars['image_name'] = $options['image_name'];     }      /**      * @param formbuilderinterface $builder      * @param array $options      */     public function buildform(formbuilderinterface $builder, array $options)     {          $builder             ->setattribute('image_name', $options['image_name'])             ->addmodeltransformer(new imagetransformer($this->path));     } } 

and service.yml:

services:     app.form_image_type:         class: appbundle\form\type\imagetype         arguments: ['%upload_directory%']         tags: [form.type] 

but when run code have error:

2/2 fileloaderloadexception in fileloader.php line 118: "tags" entry must array service "app.form_image_type" in /var/www/exammple.pl/app/config/services.yml. check yaml syntax in /var/www/example/app/config/services.yml (which being imported "/var/www/example.pl/app/config/config.yml"). 1/2 invalidargumentexception in yamlfileloader.php line 270: "tags" entry must array service "app.form_image_type" in /var/www/example.pl/app/config/services.yml. check yaml syntax.

but according docs, tags defined properly, have fixed issue ?

try code :

tags:    - { name: form.type } 

look @ doc 3.2 version


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -