Doctrine 1
  1. Doctrine 1
  2. DC-98

Generated base class file names get erroneously prefixed

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.2.0-ALPHA2
    • Fix Version/s: 1.2.0-ALPHA3
    • Component/s: Import/Export
    • Labels:
      None
    • Environment:
      Mac OS X 10.6.1 / PHP 5.3.0

      Description

      You can set the boolean option 'classPrefixFiles' to false when generating models to prevent the full class name becoming your file name. However, you this option has no effect on generated base classes. So even if you have set 'classPrefixFiles' to false, the generated files with base classes still contain the base class prefix name in their file name.

      I suggest having a 'baseClassPrefixFiles' options OR following the 'classPrefixFiles' option for base class file names as well.

      This is how the generated file names ended up in my models folder (with 'baseClassPrefix' = 'Base_'; 'classPrefixFiles' = false; 'baseClassesDirectory' = 'Base' and 'baseClassPrefixFiles' = false):

      ./Base/Base_Monkey.php
      ./Monkey.php

      Should be:

      ./Base/Monkey.php
      ./Monkey.php

        Activity

        Hide
        Jonathan H. Wage added a comment -

        This seems to work for me when I test it.

        Show
        Jonathan H. Wage added a comment - This seems to work for me when I test it.
        Hide
        Kyle Spraggs added a comment -

        baseClassPrefixFiles does absolutely nothing on v1.2.1. I have patched Doctrine_Import_Builder to provide this functionality.

        – ADD around line 132
        /**

        • Whether to use the base class prefix for the filenames too
        • @var boolean
          **/
          protected $_baseClassPrefixFiles = true;

        – MODIFY around line 1004

        • $baseClass['className'] = $this->_baseClassPrefix . $baseClass['className'];

        + if ($this->_baseClassPrefixFiles)

        { + $baseClass['className'] = $this->_baseClassPrefix . $baseClass['className']; +}
        Show
        Kyle Spraggs added a comment - baseClassPrefixFiles does absolutely nothing on v1.2.1. I have patched Doctrine_Import_Builder to provide this functionality. – ADD around line 132 /** Whether to use the base class prefix for the filenames too @var boolean **/ protected $_baseClassPrefixFiles = true; – MODIFY around line 1004 $baseClass ['className'] = $this->_baseClassPrefix . $baseClass ['className'] ; + if ($this->_baseClassPrefixFiles) { + $baseClass['className'] = $this->_baseClassPrefix . $baseClass['className']; +}
        Hide
        Kyle Spraggs added a comment -

        Seems I was a little to hasty. I'm attaching the properly patched file for review.

        Show
        Kyle Spraggs added a comment - Seems I was a little to hasty. I'm attaching the properly patched file for review.
        Hide
        Kyle Spraggs added a comment -

        Adds the option baseClassPrefixFiles (default true) to specify whether or not the base class should include the prefix in the filename.

        Show
        Kyle Spraggs added a comment - Adds the option baseClassPrefixFiles (default true) to specify whether or not the base class should include the prefix in the filename.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Pim Rupert
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: