小编use*_*305的帖子

Symfony2和Doctrine:名称为"blog.post"的表已经存在.

我使用MySql使用Symfony2和Doctrine ORM.当我尝试使用时:

 php app/console doctrine:migration:diff       
Run Code Online (Sandbox Code Playgroud)

我有这个错误:

[Doctrine\DBAL\Schema\SchemaException]           
 The table with name 'blog.post' already exists.
Run Code Online (Sandbox Code Playgroud)

我在Post.php中的代码(我使用注释)是:

 namespace Blog\ModelBundle\Entity;

 use Doctrine\ORM\Mapping as ORM;
 use Symfony\Component\Validator\Constraints as Assert;

 /**
 * Post
 *
 * @ORM\Table()
 * @ORM\Entity
 */
 class Post extends Timestampable
 {
 /**
 * @var integer
 *
 * @ORM\Column(name="id", type="integer")
 * @ORM\Id
 * @ORM\GeneratedValue(strategy="AUTO")
 */
private $id;

/**
 * @var string
 *
 * @ORM\Column(name="title", type="string", length=150)
 * @Assert\NotBlank
 */
private $title;

/**
 * @var string
 *
 * @ORM\Column(name="body", type="text")
 * @Assert\NotBlank
 */
private …
Run Code Online (Sandbox Code Playgroud)

symfony doctrine-orm

5
推荐指数
1
解决办法
4504
查看次数

标签 统计

doctrine-orm ×1

symfony ×1