Doctrine 1
  1. Doctrine 1
  2. DC-127

Allow a class prefix to be specified when calling Doctrine_Core::loadModels()

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.0-ALPHA2
    • Fix Version/s: 1.2.0-BETA1
    • Component/s: None
    • Labels:
      None

      Description

      Doctrine allows you to generate class names such as Blog_Model_Post in Post.php, but Doctrine::loadModels() is not able to load these models conservatively, as the class name and file name differ.

      I suggest adding a third parameter to Doctrine_Core::loadModels() to specify a class prefix, for example:

      Doctrine_Core::loadModels('/modules/blog/models', Doctrine_Core::MODEL_LOADING_CONSERVATIVE, 'Blog_Model_');

      Code changes (I think) would be something like this:

      public static function loadModels($directory, $modelLoading = null, $classPrefix = null)
      {
      ...
      	$className = $e[0];
      	
      	if ($classPrefix) {
      		$className = $classPrefix . $className;
      	}
      ...
      }

      Since the argument is optional, this change shouldn't break any existing code.

      NB: This is not PEAR-style file/class naming.

        Activity

        There are no comments yet on this issue.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: