public function testAllowsRegisteringArrayAutoloadMapViaConstructor() { $map = array('Zend\\Loader\\Exception' => __DIR__ . '/../../../library/Zend/Loader/Exception.php'); $loader = new ClassMapAutoloader(array($map)); $test = $loader->getAutoloadMap(); $this->assertSame($map, $test); }
public static function init() { $zf2ModulePaths = array(dirname(dirname(__DIR__))); if ($path = static::findParentPath('vendor')) { $zf2ModulePaths[] = $path; } if (($path = static::findParentPath('module')) !== $zf2ModulePaths[0]) { $zf2ModulePaths[] = $path; } static::initAutoloader(); $loader = new ClassMapAutoloader(); // Register the class map: $loader->registerAutoloadMap(__DIR__ . "/../MyLib/autoload_classmap.php"); // Register with spl_autoload: $loader->register(); // use ModuleManager to load this module and it's dependencies $config = array('module_listener_options' => array('module_paths' => $zf2ModulePaths), 'modules' => array('Application')); $serviceManager = new ServiceManager(new ServiceManagerConfig()); $serviceManager->setService('ApplicationConfig', $config); $serviceManager->get('ModuleManager')->loadModules(); static::$serviceManager = $serviceManager; }
<?php define("__FORM__", "Application\\Form\\Type\\"); define("__ENTITY__", "Application\\Model\\Entity\\"); use Silex\Application; use Zend\Loader\StandardAutoloader; use Zend\Loader\ClassMapAutoloader; use Symfony\Component\Config\FileLocator; use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\Loader\YamlFileLoader; $standarAutoloader = new StandardAutoloader(); $classmapAutoloader = new ClassMapAutoloader(); $standarAutoloader->registerNamespaces(array('Application\\' => __DIR__ . '/../')); $classmapAutoloader->registerAutoloadMap(array('PHPExcel' => __DIR__ . '/../../lib/excel/PHPExcel.php', 'PHPMailer' => __DIR__ . '/../../lib/mailer/phpmailer.php', 'SMTP' => __DIR__ . '/../../lib/mailer/class.smtp.php', 'vcalendar' => __DIR__ . '/../../lib/calendar/ical/iCalcreator.class.php')); $standarAutoloader->register(); $classmapAutoloader->register(); $app["debug"] = true; $c = new \vcalendar(array('unique_id' => $_SERVER['HTTP_HOST'])); $t =& $c->newComponent('vtodo'); $t->setProperty('dtstart', '19970415T133000 GMT'); $t->setProperty('due', '19970416T045959 GMT'); $t->setProperty('summary', '1996 Income Tax Preparation'); $t->setProperty('class', 'CONFIDENTIAL'); $t->setProperty('categories', 'FAMILY'); $t->setProperty('categories', 'FINANCE'); $t->setProperty('priority', 1); $t->setProperty('status', 'NEEDS-ACTION'); $str = $c->createCalendar(); $calendarPath = __DIR__ . '/../tmp/Calendar'; file_put_contents($calendarPath . '/sample.ics', $str); //echo $str;