本文整理汇总了PHP中Doctrine\Common\Annotations\DocParser::addNamespace方法的典型用法代码示例。如果您正苦于以下问题:PHP DocParser::addNamespace方法的具体用法?PHP DocParser::addNamespace怎么用?PHP DocParser::addNamespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\Common\Annotations\DocParser
的用法示例。
在下文中一共展示了DocParser::addNamespace方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testIssueMultipleNamespaces
public function testIssueMultipleNamespaces()
{
$docblock = "@Entity";
$parser = new DocParser();
$parser->addNamespace("Doctrine\\Tests\\Common\\Annotations\\Ticket\\Doctrine\\ORM\\Mapping");
$parser->addNamespace("Doctrine\\Tests\\Common\\Annotations\\Ticket\\Doctrine\\ORM");
$annots = $parser->parse($docblock);
$this->assertEquals(1, count($annots));
$this->assertInstanceOf("Doctrine\\Tests\\Common\\Annotations\\Ticket\\Doctrine\\ORM\\Mapping\\Entity", $annots[0]);
}
示例2: register
public function register(Application $app)
{
$app['translation-extractor.logger'] = $app->share(function (Application $app) {
return $app['monolog'];
});
$app['translation-extractor.doc-parser'] = $app->share(function () {
$parser = new DocParser();
$parser->addNamespace("JMS\\TranslationBundle\\Annotation");
return $parser;
});
$app['translation-extractor.node-visitors'] = $app->share(function (Application $app) {
return [new ConstraintExtractor($app), new ValidationExtractor($app['validator']->getMetadataFactory()), new DefaultPhpFileExtractor($app['translation-extractor.doc-parser']), new TwigFileExtractor($app['twig']), new FormExtractor($app['translation-extractor.doc-parser']), new HelpMessageExtractor($app['translation-extractor.doc-parser'])];
});
$app['translation-extractor.file-extractor'] = $app->share(function (Application $app) {
return new FileExtractor($app['twig'], $app['translation-extractor.logger'], $app['translation-extractor.node-visitors']);
});
$app['translation-extractor.extractor-manager'] = $app->share(function (Application $app) {
return new ExtractorManager($app['translation-extractor.file-extractor'], $app['translation-extractor.logger']);
});
$app['translation-extractor.writer'] = $app->share(function (Application $app) {
return new FileWriter($app['translation-extractor.writers']);
});
$app['translation-extractor.writers'] = $app->share(function () {
return ['po' => new SymfonyDumperAdapter(new PoFileDumper(), 'po'), 'xlf' => new XliffDumper()];
});
$app['translation-extractor.loader-manager'] = $app->share(function (Application $app) {
return new LoaderManager($app['translation-extractor.loaders']);
});
$app['translation-extractor.loaders'] = $app->share(function () {
return ['po' => new SymfonyLoaderAdapter(new PoFileLoader()), 'xlf' => new XliffLoader()];
});
$app['translation-extractor.updater'] = $app->share(function (Application $app) {
AnnotationRegistry::registerAutoloadNamespace('JMS\\TranslationBundle\\Annotation', $app['root.path'] . '/vendor/jms/translation-bundle');
return new Updater($app['translation-extractor.loader-manager'], $app['translation-extractor.extractor-manager'], $app['translation-extractor.logger'], $app['translation-extractor.writer']);
});
}
示例3: addNamespace
/**
* Adds a namespace in which we will look for annotations.
*
* @param string $namespace
*/
public function addNamespace($namespace)
{
$this->parser->addNamespace($namespace);
}
示例4: registerNamespace
/**
* @param string $namespace
*
* @throws RuntimeException
*/
public function registerNamespace($namespace)
{
$namespace = ltrim($namespace, '\\');
$this->docParser->addNamespace($namespace);
$this->docParser->addNamespace('\\' . $namespace);
}