add aliasing autoloader supporting old namespace
This commit is contained in:
parent
bb85f75008
commit
9402959f26
14
Tests/AutoloadAliasTest.php
Normal file
14
Tests/AutoloadAliasTest.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Propel\Bundle\PropelBundle\Tests;
|
||||
|
||||
class AutoloadAliasTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testOldNamespaceWorks()
|
||||
{
|
||||
$inflector = new \Propel\PropelBundle\Util\PropelInflector();
|
||||
|
||||
static::assertInstanceOf('Propel\PropelBundle\Util\PropelInflector', $inflector);
|
||||
static::assertInstanceOf('Propel\Bundle\PropelBundle\Util\PropelInflector', $inflector);
|
||||
}
|
||||
}
|
9
autoload_aliases.php
Normal file
9
autoload_aliases.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
function autoload_propel_aliases($className) {
|
||||
if (0 === strpos($className, 'Propel\PropelBundle')) {
|
||||
class_alias(str_replace('Propel\PropelBundle', 'Propel\Bundle\PropelBundle', $className), $className);
|
||||
}
|
||||
}
|
||||
|
||||
spl_autoload_register('autoload_propel_aliases', false, true);
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
"autoload": {
|
||||
"psr-4": { "Propel\\Bundle\\PropelBundle\\": "" },
|
||||
"files": ["autoload_aliases.php"],
|
||||
"exclude-from-classmap": [ "Tests/" ]
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue