Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-954

Custom QuoteStrategy doesn't work when creating new schema

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.4.2
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:

      Description

      Implementing custom quote strategy:

      class SingleQuoteStrategy extends DefaultQuoteStrategy implements QuoteStrategy
      {
          public function getColumnName($fieldName, ClassMetadata $class, AbstractPlatform $platform)
          {
              return isset($class->fieldMappings[$fieldName]['quoted'])
                  ? $platform->quoteSingleIdentifier($class->fieldMappings[$fieldName]['columnName'])
                  : $class->fieldMappings[$fieldName]['columnName'];
          }
      }
      

      doesn't work when a new schema is created.

      The problem is that in class file mapping I have column that has dot in its name escaped with back single quotes:

      <field name="anuncianteId_delete" type="integer" column="`anunciante_id.delete`" nullable="true"/>

      My custom quote strategy is necessary to force Doctrine to respect that. Otherwise Doctrine treats it as: namespace.name.

      If I already have table with that column in my database update schema tool doesn't complains, the problem occurs only when I try to create new schema.

      The error in resulting SQL Statement:

      (SQLSTATE[HY000]: General error: 1 near ".": syntax error' while executing DDL: CREATE TABLE account ( (...) "anunciante_id"."delete" INTEGER DEFAULT NULL, (...) )

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Piotr Łyczba
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: