本文介绍了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
发布评论