ZF2-47: Classmap generator doesn't work if you use -l switch and -o to store the file in another folder

Description

When in library/ folder run this command:


php /zf2/bin/classmap_generator.php -l ./App/ -o .classmap.php -w

This all generates a .classmap.php file in library containing the following:


<?php
return array (
  'App\\Mvc\\Route\\RegexRoute' => __DIR__ . DIRECTORY_SEPARATOR . 'Mvc' . DIRECTORY_SEPARATOR . 'Route' . DIRECTORY_SEPARATOR . 'RegexRoute.php',
);

This class map is unusable as the path to RegexRoute.php is missing the App directory name and so the autoloader cannot find the folder as the path it has created is relative to the App folder, not the folder where the .classmap.php file actually is.

Update: The same thing happens with this command when run from the App/ directory directly:


php /zf2/bin/classmap_generator.php  -o ../.classmap.php -w

Comments

Looking into this, I think that the first case is the one worth looking at as if symlink'd directories are involved using relative paths with -o causes a world of complexity.

Pull request 336 solves common use-case.

This seems to be resolved now.