Doctrine 1
  1. Doctrine 1
  2. DC-411

Doctrine::Inflector does not handle table names with dashes

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.2
    • Fix Version/s: 1.2.2
    • Component/s: None
    • Labels:
      None

      Description

      I have some tables in my DB with dashes in name, ex. "table-name".
      While generating schema.yml with ./doctrine-cli generate-yaml-db it generated model classes with dashes, ex. class Table-name ...

      Here's a small patch to treat - in table names same as _.

      — library/Doctrine/Inflector.php (wersja 7016)
      +++ library/Doctrine/Inflector.php (kopia robocza)
      @@ -57,7 +57,7 @@
      public static function classify($word)

      { $word = preg_replace('/[$]/', '', $word); - return preg_replace_callback('~(_?)(_)([\w])~', array("Doctrine_Inflector", "classifyCallback"), ucfirst(strtolower($word))); + return preg_replace_callback('~(_?)([-_])([\w])~', array("Doctrine_Inflector", "classifyCallback"), ucfirst(strtolower($word))); }

      /**

        Activity

        Hide
        Tomasz Sterna added a comment - - edited

        linebreaks got lost.
        basically (_)([\w]) turns to ([-_])([\w])

        Show
        Tomasz Sterna added a comment - - edited linebreaks got lost. basically (_)( [\w] ) turns to ( [-_] )( [\w] )

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Tomasz Sterna
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: