Doctrine 1
  1. Doctrine 1
  2. DC-1004

ATTR_TBLNAME_FORMAT not used when creating models from database

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.3
    • Fix Version/s: 1.2.3
    • Component/s: Import/Export
    • Labels:
      None

      Description

      if you set prefix to "xyz_%s" and have the model "BackgroundColor" it will become the table => "xyz_background_color"
      if you have the table "xyz_background_color" with unknown model and create the the model from the table, you will get => "XyzBackgroundColor".

      The fix (diff):

      368a369,370
      > $tablePrefix = $manager->getAttribute(Doctrine_Core::ATTR_TBLNAME_FORMAT);
      >
      381d382
      <
      385c386
      < $definition['className'] = Doctrine_Inflector::classify(Doctrine_Inflector::tableize($table));

      > $definition['className'] = Doctrine_Inflector::classify(Doctrine_Inflector::tableize(preg_replace(sprintf('/\A%s\z/', str_replace('%s', '(.*?)', $tablePrefix)), '$1', $table)));
      396c397
      < $class = Doctrine_Inflector::classify(Doctrine_Inflector::tableize($table));

      > $class = Doctrine_Inflector::classify(Doctrine_Inflector::tableize(preg_replace(sprintf('/\A%s\z/', str_replace('%s', '(.*?)', $tablePrefix)), '$1', $table)));

        Activity

        Hide
        Robin Parker added a comment -

        The diff output as .diff

        Show
        Robin Parker added a comment - The diff output as .diff

          People

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

            Dates

            • Created:
              Updated: