FOSMessageBundle

编程入门 行业动态 更新时间:2024-10-09 13:22:25
本文介绍了FOSMessageBundle - 未正确生成实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用 FOSMessageBundle,我认为我很好地遵循了说明,但我似乎无法使数据库正确生成...

I'm using FOSMessageBundle, and I thought i followed the instructions pretty well, but i cant seem to get the database to generate properly...

这是我的消息实体:

<?php namespace Acme\Bundle\DemoBundle\Entity; use Doctrine\ORM\Mapping as ORM; use JMS\Serializer\Annotation as JMS; use FOS\MessageBundle\Entity\Message as BaseMessage; use FOS\MessageBundle\Model\ParticipantInterface; /** * Message * * @ORM\Entity() * @JMS\ExclusionPolicy("All") */ class Message extends BaseMessage implements EntityInterface { /** * @var integer * * @ORM\Column(name="id", type="integer", nullable=false) * @ORM\Id * @ORM\GeneratedValue(strategy="IDENTITY") * @JMS\Groups({"list", "default"}) * @JMS\Expose() */ protected $id; /** * @var Thread * * @ORM\ManyToOne(targetEntity="Thread", inversedBy="messages", cascade={"persist"}) * @ORM\JoinColumn(name="thread_id") * @JMS\Groups({"default"}) */ protected $thread; /** * @ORM\ManyToOne(targetEntity="User") * @var ParticipantInterface */ protected $sender; /** * @ORM\OneToMany(targetEntity="MessageMetadata", mappedBy="message", cascade={"all"}) * @var MessageMetadata */ protected $metadata; }

还有我的config.yml

fos_message: db_driver: orm thread_class: Acme\Bundle\DemoBundle\Entity\Thread message_class: Acme\Bundle\DemoBundle\Entity\Message

问题是,我的表最后只有 id、thread_id 和 sender_id.它缺少其余的字段.

The issue is, my table ends up with only id, thread_id, and sender_id. Its missing the rest of the fields.

我错过了什么!

推荐答案

Merk,项目的贡献者之一指出我将实体下的 auto_mapping 设置为 true经理.

Merk, one of the contributors to the project pointed me at setting auto_mapping to true under the entity manager.

一旦我设置了这个,它就解决了我的问题!

Once i set this, it solved my issue!

更多推荐

FOSMessageBundle

本文发布于:2023-10-10 22:06:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1479890.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:FOSMessageBundle

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!