0 votes

Skipper Build 3.2.22.1624
Symfony 4.4.1
Doctrine ORM 2.7.0

I have a problem with our setup and combined unique keys. The column definition is exported "as-is" (with camelCase column names). But in our doctrine.yaml we have:

naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware

The resulting export is:

* @ORM\Table(uniqueConstraints={@ORM\UniqueConstraint(name="CityUnique", columns={"city","countryCode"})})

which leads to the error:

$ php bin/console make:mig

In SchemaException.php line 82:

 There is no column with name 'countryCode' on table 'city'.

The db-naming-strategy on the index is set to underscore-lower, but to no effect.

Edit: I see, I have to set the db-naming-strategy on the Bundle! Then it's exported correctly. But shouldn't Skipper also consider the setting on index level? What does that do anyway?

.

Minimal working example:

<?xml version="1.0"?>
<skipper version="3.2.22.1624" mvc="Symfony" orm="Doctrine2" name="CombinedUniqueCasingBug" uuid="80e32f16-3bca-43a6-b0a9-a79e6031bcfd">
  <module name="\MainBundle" local-name="MainBundle" namespace="\" export-format="Doctrine2Php" export-path="." uuid="cd31ef60-361c-4fab-8296-1149aea063d9">
    <entity name="\City" local-name="City" namespace="\" uuid="23f6cc2f-c7eb-468b-bdbe-41959a0ac413">
      <field name="id" type="integer" required="true" unique="true" primary="true" auto-increment="true" uuid="1ffad554-fadb-4878-8002-f87248be9ea3"/>
      <field name="city" type="string" size="255" uuid="b37fe101-5b5e-4dbc-a255-455be0c5bc8b"/>
      <field name="countryCode" type="string" size="2" uuid="c94a2f4a-a5dd-49d2-920d-a7c5797d8425"/>
      <index name="CityUnique" unique="true" uuid="1259fd89-cfc2-4696-8460-78bafa55b28c">
        <index-field name="city" uuid="21ad701d-5071-4975-b735-a87ac0194c47"/>
        <index-field name="countryCode" uuid="fec6c53e-6663-4f7a-a7d7-5445e7c50106"/>
        <orm-attributes>
          <attribute name="db-naming-strategy">underscore-lower</attribute>
        </orm-attributes>
      </index>
    </entity>
  </module>
  <visual-data>
    <entity uuid="23f6cc2f-c7eb-468b-bdbe-41959a0ac413" bg-color="#FFFFFF" hdr-color="#D2D2D2" position-x="10" position-y="20"/>
    <module uuid="cd31ef60-361c-4fab-8296-1149aea063d9" bg-color="#FEFCE8" position-x="61" position-y="72" size-x="11" size-x2="220" size-y="22" size-y2="163"/>
    <project uuid="80e32f16-3bca-43a6-b0a9-a79e6031bcfd" size-x="0" size-x2="331" size-y="0" size-y2="285"/>
  </visual-data>
</skipper>
asked in Bug report by (3.6k points)

Please log in or register to answer this question.