Hardcoded -2 fails when namespace is longer. E.g. namespace="Sensio\Bundle\HelloBundle\Model"

This commit is contained in:
osek666 2011-07-05 02:46:23 -07:00
parent 06b5f2783d
commit d5ce54b7de

View file

@ -58,7 +58,8 @@ abstract class PhingCommand extends ContainerAwareCommand
$schemas = $finder->files()->name('*schema.xml')->followLinks()->in($dir);
$parts = explode(DIRECTORY_SEPARATOR, realpath($bundle->getPath()));
$prefix = implode('.', array_slice($parts, 1, -2));
$length = count(explode('\\', $bundle->getNamespace())) * (-1);
$prefix = implode('.', array_slice($parts, 1, $length));
foreach ($schemas as $schema) {
$tempSchema = md5($schema).'_'.$schema->getBaseName();