public function __construct() { $this->cache = A7::getCache(); AnnotationRegistry::registerAutoloadNamespace('A7\\Annotations', __DIR__ . '/../'); $this->annotationReader = new SimpleAnnotationReader(); $this->annotationReader->addNamespace('A7\\Annotations'); }
public function setup() { $class = new ReflectionClass('Doctrine\\ORM\\Mapping\\Annotation'); $filename = $class->getFileName(); AnnotationRegistry::registerLoader('class_exists'); AnnotationRegistry::registerAutoloadNamespace("Doctrine\\ORM\\Mapping", dirname($filename)); }
private function generateXML($tmpDir) { AnnotationRegistry::registerAutoloadNamespace('JMS\\Serializer\\Annotation', __DIR__ . "/../../../../vendor/jms/serializer/src"); Model\Provider::setOutputDirectory($tmpDir); Allure::setDefaultLifecycle(); $testSuiteStartedEvent = new TestSuiteStartedEvent(TEST_SUITE_NAME); $uuid = $testSuiteStartedEvent->getUuid(); $testSuiteStartedEvent->setTitle(TEST_SUITE_TITLE); $testSuiteStartedEvent->setDescription(new Description(DescriptionType::HTML, DESCRIPTION)); $testSuiteStartedEvent->setLabels([Label::feature(FEATURE_NAME), Label::story(STORY_NAME)]); Allure::lifecycle()->fire($testSuiteStartedEvent); $testCaseStartedEvent = new TestCaseStartedEvent($uuid, TEST_CASE_NAME); $testCaseStartedEvent->setDescription(new Description(DescriptionType::MARKDOWN, DESCRIPTION)); $testCaseStartedEvent->setLabels([Label::feature(FEATURE_NAME), Label::story(STORY_NAME), Label::severity(SeverityLevel::MINOR)]); $testCaseStartedEvent->setTitle(TEST_CASE_TITLE); $testCaseStartedEvent->setParameters([new Parameter(PARAMETER_NAME, PARAMETER_VALUE, ParameterKind::SYSTEM_PROPERTY)]); Allure::lifecycle()->fire($testCaseStartedEvent); $testCaseFailureEvent = new TestCaseFailedEvent(); $testCaseFailureEvent = $testCaseFailureEvent->withMessage(FAILURE_MESSAGE)->withException(new \Exception()); Allure::lifecycle()->fire($testCaseFailureEvent); $stepStartedEvent = new StepStartedEvent(STEP_NAME); $stepStartedEvent = $stepStartedEvent->withTitle(STEP_TITLE); Allure::lifecycle()->fire($stepStartedEvent); Allure::lifecycle()->fire(new AddAttachmentEvent(STEP_ATTACHMENT_SOURCE, STEP_ATTACHMENT_TITLE, 'text/plain')); Allure::lifecycle()->fire(new StepFinishedEvent()); Allure::lifecycle()->fire(new TestCaseFinishedEvent()); Allure::lifecycle()->fire(new TestSuiteFinishedEvent($uuid)); return $uuid; }
/** * @param string $class */ public function __construct($class) { AnnotationRegistry::registerAutoloadNamespace('WSDL\\Annotation', Path::join(__DIR__, '..', '..')); $this->class = $class; $this->builder = WSDLBuilder::instance(); $this->annotationReader = new AnnotationReader(); }
public function register(Application $app) { $app['serializer.cache-directory'] = $app->share(function () use($app) { return $app['cache.path'] . '/serializer/'; }); $app['serializer.metadata_dirs'] = $app->share(function () { return []; }); $app['serializer.handlers'] = $app->share(function () { return []; }); $app['serializer'] = $app->share(function (Application $app) { // Register JMS annotation into Doctrine's registry AnnotationRegistry::registerAutoloadNamespace('JMS\\Serializer\\Annotation', $app['root.path'] . '/vendor/jms/serializer/src/'); $builder = SerializerBuilder::create()->setCacheDir($app['serializer.cache-directory'])->setDebug($app['debug']); if (!empty($app['serializer.metadata_dirs'])) { $builder->addMetadataDirs($app['serializer.metadata_dirs']); } if (!empty($app['serializer.handlers'])) { $builder->configureHandlers(function (HandlerRegistryInterface $registry) use($app) { foreach ($app['serializer.handlers'] as $handler) { $registry->registerSubscribingHandler($handler); } }); } return $builder->build(); }); }
public function init(ModuleManagerInterface $manager) { $this->moduleManager = $manager; $namespace = 'Gedmo\\Mapping\\Annotation'; $libPath = 'vendor/Gedmo/doctrine-extension/lib'; AnnotationRegistry::registerAutoloadNamespace($namespace, $libPath); }
public function onBootstrap(MvcEvent $e) { $eventManager = $e->getApplication()->getEventManager(); $moduleRouteListener = new ModuleRouteListener(); $moduleRouteListener->attach($eventManager); AnnotationRegistry::registerAutoloadNamespace('TgBotApi\\Model\\Annotation'); }
public function __construct(Reader $reader = null) { $this->reader = $reader ?: new AnnotationReader(); // register our own namespace in the doctrine annotation-class-registry // not quite sure, why this is necessary AnnotationRegistry::registerAutoloadNamespace('Hydra\\', array(dirname(dirname(__DIR__)))); }
public function register(Application $app) { //Load Doctrine Configuration $app['db.configuration'] = $app->share(function () use($app) { AnnotationRegistry::registerAutoloadNamespace("Doctrine\\ORM\\Mapping", __DIR__ . '/../../../../../doctrine/orm/lib'); $config = new ORMConfiguration(); $cache = $app['debug'] == false ? new ApcCache() : new ArrayCache(); $config->setMetadataCacheImpl($cache); $config->setQueryCacheImpl($cache); $chain = new DriverChain(); foreach ((array) $app['db.orm.entities'] as $entity) { switch ($entity['type']) { case 'annotation': $reader = new AnnotationReader(); $driver = new AnnotationDriver($reader, (array) $entity['path']); $chain->addDriver($driver, $entity['namespace']); break; /*case 'yml': $driver = new YamlDriver((array)$entity['path']); $driver->setFileExtension('.yml'); $chain->addDriver($driver, $entity['namespace']); break; case 'xml': $driver = new XmlDriver((array)$entity['path'], $entity['namespace']); $driver->setFileExtension('.xml'); $chain->addDriver($driver, $entity['namespace']); break;*/ /*case 'yml': $driver = new YamlDriver((array)$entity['path']); $driver->setFileExtension('.yml'); $chain->addDriver($driver, $entity['namespace']); break; case 'xml': $driver = new XmlDriver((array)$entity['path'], $entity['namespace']); $driver->setFileExtension('.xml'); $chain->addDriver($driver, $entity['namespace']); break;*/ default: throw new \InvalidArgumentException(sprintf('"%s" is not a recognized driver', $type)); break; } } $config->setMetadataDriverImpl($chain); $config->setProxyDir($app['db.orm.proxies_dir']); $config->setProxyNamespace($app['db.orm.proxies_namespace']); $config->setAutoGenerateProxyClasses($app['db.orm.auto_generate_proxies']); return $config; }); //Set Defaut Configuration $defaults = array('entities' => array(array('type' => 'annotation', 'path' => 'Entity', 'namespace' => 'Entity')), 'proxies_dir' => 'cache/doctrine/Proxy', 'proxies_namespace' => 'DoctrineProxy', 'auto_generate_proxies' => true); foreach ($defaults as $key => $value) { if (!isset($app['db.orm.' . $key])) { $app['db.orm.' . $key] = $value; } } $self = $this; $app['db.orm.em'] = $app->share(function () use($self, $app) { return EntityManager::create($app['db'], $app['db.configuration']); }); }
protected static function registerValidatorAnnotations($force = false) { if (!$force && self::$registered) { return; } $refl = new \ReflectionClass(Validation::class); if ($refl->getFileName() === false) { // We can't setup the auto loading without knowing the path return; } $filePath = str_replace('\\', '/', $refl->getFileName()); // Detect PSR-0 loading $psr0Path = '/Symfony/Component/Validator/Validation.php'; if (substr($filePath, -strlen($psr0Path)) === $psr0Path) { AnnotationRegistry::registerAutoloadNamespace('Symfony\\Component\\Validator\\Constraints', substr($filePath, 0, -strlen($psr0Path))); self::$registered = true; return; } // Custom PSR-4 loader $constraintsDir = dirname($filePath) . '/Constraints/'; AnnotationRegistry::registerLoader(function ($class) use($constraintsDir) { $ns = 'Symfony\\Component\\Validator\\Constraints\\'; if (strpos($class, $ns) !== 0) { return; } $filePath = $constraintsDir . str_replace('\\', DIRECTORY_SEPARATOR, substr($class, strlen($ns))) . '.php'; if (file_exists($filePath)) { include $filePath; return true; } }); self::$registered = true; }
/** * * @return \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain */ public function getMetadataDriverImpl() { // Register the doctrine Annotations \Doctrine\Common\Annotations\AnnotationRegistry::registerFile('doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'); $legacyNamespace = $this->getConfigRepository()->get('app.enable_legacy_src_namespace'); if ($legacyNamespace) { \Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace('Application\\Src', DIR_BASE . '/application/src'); } else { \Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace('Application\\Entity', DIR_BASE . '/application/src/Entity'); } // Remove all unkown annotations from the AnnotationReader used by the SimpleAnnotationReader // to prevent fatal errors $this->registerGlobalIgnoredAnnotations(); // initiate the driver chain which will hold all driver instances $driverChain = $this->app->make('Doctrine\\Common\\Persistence\\Mapping\\Driver\\MappingDriverChain'); $coreDriver = new CoreDriver($this->app); $driver = $coreDriver->getDriver(); $driver->addExcludePaths($this->getConfigRepository()->get('database.proxy_exclusions', array())); $driverChain->addDriver($driver, $coreDriver->getNamespace()); // Register application metadata driver $config = $this->getConfigRepository(); $applicationDriver = new ApplicationDriver($config, $this->app); $driver = $applicationDriver->getDriver(); if (is_object($driver)) { // $driver might be null, if there's no application/src/Entity $driverChain->addDriver($driver, $applicationDriver->getNamespace()); } return $driverChain; }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $model = $input->getArgument('model'); $seeds = $input->getArgument('seeds'); $io = new SymfonyStyle($input, $output); if (!class_exists($model)) { $io->error(array('The model you specified does not exist.', 'You can create a model with the "model:create" command.')); return 1; } $this->dm = $this->createDocumentManager($input->getOption('server')); $faker = Faker\Factory::create(); AnnotationRegistry::registerAutoloadNamespace('Hive\\Annotations', dirname(__FILE__) . '/../../'); $reflectionClass = new \ReflectionClass($model); $properties = $reflectionClass->getProperties(\ReflectionProperty::IS_PUBLIC); $reader = new AnnotationReader(); for ($i = 0; $i < $seeds; $i++) { $instance = new $model(); foreach ($properties as $property) { $name = $property->getName(); $seed = $reader->getPropertyAnnotation($property, 'Hive\\Annotations\\Seed'); if ($seed !== null) { $fake = $seed->fake; if (class_exists($fake)) { $instance->{$name} = $this->createFakeReference($fake); } else { $instance->{$name} = $faker->{$seed->fake}; } } } $this->dm->persist($instance); } $this->dm->flush(); $io->success(array("Created {$seeds} seeds for {$model}")); }
/** * @throws \Doctrine\ORM\ORMException */ public function boot() { $this->serializer = SerializerBuilder::create()->setDebug($this->devMode)->build(); $this->entityFolder->create(); AnnotationRegistry::registerAutoloadNamespace('JMS\\Serializer\\Annotation', __DIR__ . '/../../../../vendor/jms/serializer/src'); $proxyDoctrineFolder = new Folder(sys_get_temp_dir() . '/doctrine'); $config = Setup::createAnnotationMetadataConfiguration([$this->entityFolder->absolute()], $this->isDevMode(), $proxyDoctrineFolder->absolute()); if ($this->cache !== null) { $config->setQueryCacheImpl($this->getCache()); $config->setResultCacheImpl($this->getCache()); } $this->entityManager = $this->createEntityManager($config); $debugStack = new DebugStack(); $this->entityManager->getConnection()->getConfiguration()->setSQLLogger($debugStack); if ($this->getFileCreation()->getContent() == 1) { return; } if ($proxyDoctrineFolder->isFolder()) { $proxyDoctrineFolder->removeFiles(); } $tool = new SchemaTool($this->entityManager); $metadatas = $this->entityManager->getMetadataFactory()->getAllMetadata(); $proxyDoctrineFolder->create(); $this->entityManager->getProxyFactory()->generateProxyClasses($metadatas, $proxyDoctrineFolder->absolute()); if ($this->cloudFoundryBoot->isInCloudFoundry()) { $tool->updateSchema($metadatas); } else { $tool->createSchema($metadatas); } $this->getFileCreation()->setContent(1); }
public function setUp() { AnnotationRegistry::registerAutoloadNamespace('Matmar10\\Bundle\\RestApiBundle\\Annotation', __DIR__ . '/../../../../../src'); $container = $this->getKernel()->getContainer(); $annotationReader = $container->get('annotation_reader'); $this->controllerAnnotationReader = new ControllerAnnotationReader($annotationReader); }
/** * Initializes annotations in application. * * @param Core $core */ public function init(Core $core) { AnnotationRegistry::registerAutoloadNamespace('\\Dgafka\\AuthorizationSecurity\\UI\\Annotation\\Type', __DIR__ . '/Type'); $expressionReader = new ExpressionReader(new ExpressionLanguage($core->config()->debugMode() ? null : new ExpressionLanguageCache(new FilesystemCache($core->config()->cachePath() . '/expressions')))); $aopKernel = Kernel::getInstance(); $aopKernel->init(array('debug' => $core->config()->debugMode(), 'cacheDir' => $core->config()->cachePath() . '/aop', 'includePaths' => $core->config()->includePaths())); $core->initialize(DIContainer::getInstance(), $expressionReader); }
public function setUp() { $kernel = $this->createKernel(); $kernel->boot(); $this->currencyManager = $kernel->getContainer()->get('matmar10_money.currency_manager'); $this->compositePropertyService = $kernel->getContainer()->get('matmar10_money.composite_property_service'); AnnotationRegistry::registerAutoloadNamespace('Matmar10\\Bundle\\MoneyBundle\\Annotation', __DIR__ . '/../../../src/'); }
/** * Activates registry autoloader for annotation declarations. * May only be called once. */ private static function initRegistry() { if (self::$registryActivated) { return; } AnnotationRegistry::registerAutoloadNamespace('Backplane\\APIdocGenerator\\Annotations', realpath(__DIR__ . '/../../..')); self::$registryActivated = true; }
public function testIssue() { AnnotationRegistry::registerAutoloadNamespace('Doctrine\\Tests\\Common\\Annotations\\Fixtures', __DIR__ . '/../../../../../'); $class = new \ReflectionClass(__NAMESPACE__ . '\\Dummy'); $reader = new \Doctrine\Common\Annotations\AnnotationReader(); $annots = $reader->getClassAnnotations($class); $this->assertEquals(0, count($annots)); }
/** * @param string $controllerPath path to the controllers * @param string $namespace namespace of the controllers */ public function __construct($controllerPath, $namespace) { $this->controllerPath = $controllerPath; $this->namespace = $namespace; $this->annotationReader = new AnnotationReader(); // need to let the annotation registry know where to find the annotations AnnotationRegistry::registerAutoloadNamespace('ApiCreator\\Annotations', dirname(__DIR__)); }
public function __construct() { AnnotationRegistry::registerAutoloadNamespace(self::ANNOTATION_NS); $this->reader = new AnnotationReader(); if (!Type::hasType(strtolower(self::ANNOTATION_TSVECTOR))) { Type::addType(strtolower(self::ANNOTATION_TSVECTOR), TsVectorType::class); } }
public function __construct() { // Load annotation classes AnnotationRegistry::registerAutoloadNamespace('Nerdstorm\\GoogleBooks\\Annotations\\Definition', self::BASE_PATH); $this->accessor = PropertyAccess::createPropertyAccessor(); $this->reader = new AnnotationReader(); $this->mapClassAnnotations(); }
protected function setUp() { parent::setUp(); AnnotationRegistry::registerAutoloadNamespace('DMS\\Bundle\\FilterBundle\\Rule', __DIR__ . '/../../../../'); $this->reader = new AnnotationReader(); $this->loader = new AnnotationLoader($this->reader); $this->factory = new ClassMetadataFactory($this->loader); }
/** * * @param ProcessorInterface[] $processors * @param string $filename */ public function __construct($processors, $filename = null) { $this->processors = $processors; AnnotationRegistry::registerAutoloadNamespace(__NAMESPACE__, dirname(__DIR__)); if ($filename !== null) { $this->parseFile($filename); } }
/** * Cria uma nova instância do framework. * * @param Application $app */ public function __construct(Application $app) { $this->app = $app; $this->checkParameters(); $this->reader = new AnnotationReader(); $this->autoRequire = new AutoRequire($app['neton.framework.requires'], $app); $this->configLoader = new ConfigLoader($app); AnnotationRegistry::registerAutoloadNamespace("Neton\\Silex\\Framework\\Annotation", __DIR__ . "/../../../"); }
/** * This method registers the required namespace with the Doctrine annotation library. */ public function registerNamespace() { if (empty(static::$initialized)) { AnnotationRegistry::registerAutoloadNamespace(__NAMESPACE__ . '\\Annotation', realpath(__DIR__ . "/../..")); } if (empty(static::$annotationReader)) { static::$annotationReader = new AnnotationReader(); } }
/** * Migrates the database and set the mailer to 'pretend'. * This will cause the tests to run quickly. */ private function prepareForTests() { \Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace('JMS\\Serializer\\Annotation', __DIR__ . '/vendor/jms/serializer/src'); $this->em = $this->app->make(\Doctrine\ORM\EntityManager::class); $this->executor = new ORMExecutor($this->em, new ORMPurger()); $this->loader = new Loader(); //$this->loader->addFixture(new TestFixtures); //$this->executor->execute($this->loader->getFixtures()); }
/** * {@inheritDoc} */ public function load(array $configs, ContainerBuilder $container) { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('services.yml'); $container->setParameter('dms_filter.auto_filter_forms', $config['auto_filter_forms']); AnnotationRegistry::registerAutoloadNamespace('DMS\\Bundle\\FilterBundle\\Rule', __DIR__ . '/../../../'); }
public static function setAnnotationReader(ReaderInterface $reader) { if (!self::$_namespaceAdded) { $directory = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..'); \Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace('SlimForm', $directory); self::$_namespaceAdded = true; } self::$_reader = $reader; }
/** * Instantiates a new annotation reader, optionally injecting a cache * mechanism for it. * This reader is basically a proxy wrapping Doctrine's one. * * @param Cache $cacheReader */ public function __construct(Cache $cacheReader = null) { if (!$cacheReader) { $cacheReader = $this->createCacheProvider(); } $this->reader = new CachedReader(new AnnotationReader(), $cacheReader); AnnotationRegistry::registerAutoloadNamespace("Doctrine\\OrientDB"); AnnotationRegistry::registerFile(__DIR__ . '/Document.php'); AnnotationRegistry::registerFile(__DIR__ . '/Property.php'); }
public function createApplication() { \Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace('JMS\\Serializer\\Annotation', __DIR__ . '/../vendor/jms/serializer/src'); $app = new \Domora\TvGuide\Application(); $app['debug'] = true; $app['exception_handler']->disable(); $app->loadRoutes(); umask(00); return $app; }