autoload.php 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. use Symfony\Component\ClassLoader\UniversalClassLoader;
  3. use Doctrine\Common\Annotations\AnnotationRegistry;
  4. $loader = new UniversalClassLoader();
  5. $loader->registerNamespaces(array(
  6. 'Symfony' => array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'),
  7. 'Sensio' => __DIR__.'/../vendor/bundles',
  8. 'JMS' => __DIR__.'/../vendor/bundles',
  9. 'Doctrine\\Common' => __DIR__.'/../vendor/doctrine-common/lib',
  10. 'Doctrine\\DBAL' => __DIR__.'/../vendor/doctrine-dbal/lib',
  11. 'Doctrine' => __DIR__.'/../vendor/doctrine/lib',
  12. 'Monolog' => __DIR__.'/../vendor/monolog/src',
  13. 'Assetic' => __DIR__.'/../vendor/assetic/src',
  14. 'Metadata' => __DIR__.'/../vendor/metadata/src',
  15. ));
  16. $loader->registerPrefixes(array(
  17. 'Twig_Extensions_' => __DIR__.'/../vendor/twig-extensions/lib',
  18. 'Twig_' => __DIR__.'/../vendor/twig/lib',
  19. ));
  20. // intl
  21. if (!function_exists('intl_get_error_code')) {
  22. require_once __DIR__.'/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
  23. $loader->registerPrefixFallbacks(array(__DIR__.'/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs'));
  24. }
  25. $loader->registerNamespaceFallbacks(array(
  26. __DIR__.'/../src',
  27. ));
  28. $loader->register();
  29. AnnotationRegistry::registerLoader(function($class) use ($loader) {
  30. $loader->loadClass($class);
  31. return class_exists($class, false);
  32. });
  33. AnnotationRegistry::registerFile(__DIR__.'/../vendor/doctrine/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');
  34. // Swiftmailer needs a special autoloader to allow
  35. // the lazy loading of the init file (which is expensive)
  36. require_once __DIR__.'/../vendor/swiftmailer/lib/classes/Swift.php';
  37. Swift::registerAutoload(__DIR__.'/../vendor/swiftmailer/lib/swift_init.php');