fosmessagebundle不能将fos_message声明为服务

时间:2014-06-25 08:33:19

标签: symfony fosuserbundle


我想覆盖用于
的NewThreadMessageFormType 1.删​​除主题(不需要)
2 css设计,即自定义表单以使用form_row(form.recipient)
而不是 {{form_widget(form)}}

我正在考虑依赖性错误
我已经成功地推荐了Profile + Edit Forms
但遵循Message Bundle的相同步骤不起作用 TIA
// ------------------------------------------------ --------------------- ERRORS

[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
Unable to replace alias "conn_user_new_thread.new_thread_form.type" with             "fos_message.new_thread_form.type".

[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
The service definition "conn_user_new_thread.new_thread_form.type" does not exist.

// --------------------------------------------- ------------------------

config.yml:
    fos_message:
        db_driver: orm
        thread_class: Conn\AaBundle\Entity\Thread
        message_class: Conn\AaBundle\Entity\Message
        new_thread_form:
            type: conn_user_new_thread.new_thread_form.type
            # handler: conn_user.form.handler.thread
            # handler: fos_message.new_thread_form.handler
            # model: FOS\MessageBundle\FormModel\NewThreadMessage
            model: Conn\AaBundle\FormModel\NewThreadMessage
            # validation_groups: [ConnThread]

// --------------------------------------------- ------------------------ services.yml:

conn_user_new_thread.new_thread_form.type:
    class: Conn\AaBundle\FormType\NewThreadMessageFormType
    # arguments: [%fos_message.thread_class%]
    tags:
        - { name: form.type, alias: conn_user_new_thread }

// --------------------------------------------- ----------------     命名空间Conn \ AaBundle \ FormType;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use FOS\MessageBundle\FormType\NewThreadMessageFormType as mBaseType;

class NewThreadMessageFormType extends mBaseType{
.....
....
....
public function getName()
{
    return 'conn_user_new_thread';
}

1 个答案:

答案 0 :(得分:0)

我在xxx \ xxxBundle \ config文件夹中有一个services.yml和一个services.xml 并正在编辑services.yml
哪个没被读过。
对services.xml文件进行更改为我解决了这个问题。
我有一个routing.yml文件,用于在同一文件夹中的路由
这让我很困惑 归功于@stof
https://github.com/FriendsOfSymfony/FOSMessageBundle/issues/227