doctrine复合主键迁移

时间:2017-02-28 09:53:26

标签: mysql doctrine symfony doctrine-migrations

  1. 我的Symfony项目中有一个带有复合主键的Doctrine实体:
  2.   var onTap = function(marker) {
        console.log("Marker tapped with title: '" + marker.title + "'");
      };
      var onCalloutTap = function(marker) {
        alert("Marker callout tapped with title: '" + marker.title + "'");
      };
    
      mapbox.addMarkers([
        {
          id: 2, // can be user in 'removeMarkers()'
          lat: 52.3602160, // mandatory
          lng: 4.8891680, // mandatory
          title: 'One-line title here', // no popup unless set
          subtitle: 'Infamous subtitle!',
          icon: 'res://cool_marker', // preferred way, otherwise use:
          icon: 'http(s)://website/coolimage.png', // from the internet (see the note at the bottom of this readme), or:
          iconPath: 'res/markers/home_marker.png',
          onTap: onTap,
          onCalloutTap: onCalloutTap
        },
        {
          ..
        }
      ])
    
    1. 运行/** * @ORM\Entity * @ORM\Table(name="`content_article_serie_reference`") */ class ArticleSerieReference { /** * @ORM\Id * @ORM\ManyToOne(targetEntity="Article", inversedBy="series") * @ORM\JoinColumn(name="article", referencedColumnName="id") */ protected $article; /** * @ORM\Id * @ORM\ManyToOne(targetEntity="Serie") * @ORM\JoinColumn(name="serie", referencedColumnName="id") */ protected $serie; 以创建迁移
    2. Doctrine为MySQL数据库创建PRIMARY KEY(文章,系列),INDEX(文章),INDEX(serie)。
    3. 有没有办法告诉Doctrine不要创建这个无用的“文章”索引?

0 个答案:

没有答案