我尝试使用自己的ImageType配置EasyAdminBundle以在我的ArticleType中上传文件.所以我创建了这个服务app\config\services.yml:
services:
oah_news_form_type_image:
class: OAH\NewsBundle\Form\ImageType
tags: [ { name: form.type, alias: 'oah_news_form_type_image' } ]
Run Code Online (Sandbox Code Playgroud)
并试图在我的电话中调用它app\config\config.yml:
easy_admin:
entities:
Article:
class: OAH\NewsBundle\Entity\Article
form:
fields:
- Titre
- Auteur
- Date
- Categorie
- { property : 'Image', type : oah_news_form_type_image}
Run Code Online (Sandbox Code Playgroud)
但我有以下错误,我不知道如何解决它:
The type name specified for the service "oah_news_form_type_image" does not match the actual name. Expected "oah_news_form_type_image", given "oah_newsbundle_image"
Run Code Online (Sandbox Code Playgroud)
我的ImageType:
class ImageType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface …Run Code Online (Sandbox Code Playgroud)