Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Symfony3和XML向列添加MySQL索引_Xml_Symfony_Doctrine - Fatal编程技术网

使用Symfony3和XML向列添加MySQL索引

使用Symfony3和XML向列添加MySQL索引,xml,symfony,doctrine,Xml,Symfony,Doctrine,我在Symfony3中有以下XML文件,我想在videoPublisherDate列中添加一个MYSQL索引,因为我将对它进行多次查询并根据它进行排序。我可以通过PHPMYADMIN手动添加它,但我想知道如何更新下面的xml,以便自动完成 谢谢 <?xml version="1.0" encoding="utf-8"?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mappi

我在Symfony3中有以下XML文件,我想在
videoPublisherDate
列中添加一个MYSQL索引,因为我将对它进行多次查询并根据它进行排序。我可以通过PHPMYADMIN手动添加它,但我想知道如何更新下面的xml,以便自动完成

谢谢

<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
  <entity name="AppBundle\Entity\Videos" table="videos">
    <unique-constraints>
        <unique-constraint columns="video_id" name="search_idx_videos" />
    </unique-constraints>
    <id name="id" type="integer" column="id">
      <generator strategy="IDENTITY"/>
    </id>
    <field name="videoSource" type="text" column="video_source" length="65535" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
    <field name="videoId" type="string" column="video_id" length="50" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
    <field name="videoTitle" type="text" column="video_title" length="65535" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
    <field name="videoImage" type="text" column="video_image" length="65535" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
    <field name="videoPublisher" type="text" column="video_publisher" length="65535" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
    <field name="videoPublisherId" type="text" column="video_publisher_id" length="65535" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
    <field name="videoPublisherDate" type="text" column="video_publisher_date" length="65535" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
    <field name="videoLength" type="integer" column="video_length" nullable="false">
      <options>
        <option name="unsigned"/>
      </options>
    </field>
    <field name="videoActive" type="integer" column="video_active" nullable="false">
      <options>
        <option name="unsigned"/>
        <option name="default">1</option>
      </options>
    </field>
    <field name="videoTags" type="text" column="video_tags" length="65535" nullable="false">
      <options>
        <option name="fixed"/>
      </options>
    </field>
  </entity>
</doctrine-mapping>

1.

您可以在xml定义中添加索引,就像处理唯一约束一样:

<indexes>
    <index name="name_videoPublisherDate" columns="video_publisher_date"/>
</indexes>