Example #1
0
 public function testUseIncludePath()
 {
     $loader = new ClassLoader();
     $this->assertFalse($loader->getUseIncludePath());
     $this->assertNull($loader->findFile('Foo'));
     $includePath = get_include_path();
     $loader->setUseIncludePath(true);
     $this->assertTrue($loader->getUseIncludePath());
     set_include_path(__DIR__ . '/Fixtures/includepath' . PATH_SEPARATOR . $includePath);
     $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'includepath' . DIRECTORY_SEPARATOR . 'Foo.php', $loader->findFile('Foo'));
     set_include_path($includePath);
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function buildDefaultConfiguration($resourceName = null, OutputInterface $output = null)
 {
     $this->setBundle($resourceName);
     $this->output = $output;
     //Model directory
     if (!$this->configuration['directory']) {
         $this->configuration['directory'] = $this->bundle->getPath() . '/Form/Type';
     }
     //Model namespace
     if (!$this->configuration['namespace']) {
         $this->configuration['namespace'] = $this->bundle->getNamespace() . '\\Form\\Type';
     }
     if (!$this->configuration['path']) {
         $loader = new ClassLoader();
         $loader->setUseIncludePath(true);
         $namespace = $this->registry->getAliasNamespace($this->bundle->getName()) . '\\' . $this->model;
         $test = new $namespace();
         $reflector = new \ReflectionClass(get_class($test));
         $entity = $loader->findFile(dirname($reflector->getFileName()) . '\\' . $this->model);
         $this->configuration['path'] = $entity;
     }
     $this->setSkeletonDirs($this->getSkeletonDirs($this->bundle));
     $this->_initialized = true;
 }
Example #3
0
<?php

// Work around the lack of proper autoload.php from composer by using
// the ClassLoader element from Symfony.
// http://symfony.com/doc/current/components/class_loader/class_loader.html
require_once 'Symfony/Component/ClassLoader/ClassLoader.php';
use Symfony\Component\ClassLoader\ClassLoader;
$loader = new ClassLoader();
$loader->setUseIncludePath(true);
$loader->register();
$loader->addPrefixes(array());
// Load additional files as registered in composer
require_once 'getid3/getid3.php';
require_once 'libphp-phpmailer/class.phpmailer.php';
require_once 'libphp-phpmailer/class.pop3.php';
require_once 'libphp-phpmailer/class.smtp.php';
require_once 'Assetic/functions.php';
require_once 'Crypt/Random.php';