当前位置: 首页>>代码示例>>PHP>>正文


PHP AnnotationRegistry::loadAnnotationClass方法代码示例

本文整理汇总了PHP中Doctrine\Common\Annotations\AnnotationRegistry::loadAnnotationClass方法的典型用法代码示例。如果您正苦于以下问题:PHP AnnotationRegistry::loadAnnotationClass方法的具体用法?PHP AnnotationRegistry::loadAnnotationClass怎么用?PHP AnnotationRegistry::loadAnnotationClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\Common\Annotations\AnnotationRegistry的用法示例。


在下文中一共展示了AnnotationRegistry::loadAnnotationClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testBootRegistersAnnotationInLoader

 /**
  * Test that calling boot() registers our annotation in the AnnotationRegistry.
  *
  * @return void
  */
 public function testBootRegistersAnnotationInLoader()
 {
     $bundle = new TensideCoreBundle();
     AnnotationRegistry::reset();
     $this->assertFalse(AnnotationRegistry::loadAnnotationClass('Tenside\\CoreBundle\\Annotation\\ApiDescription'));
     $this->assertFalse(class_exists('Tenside\\CoreBundle\\Annotation\\ApiDescription', false));
     $bundle->boot();
     $this->assertFalse(AnnotationRegistry::loadAnnotationClass('NonExistant\\Annotation'));
     // Ensure the class does not get loaded by requiring another annotation.
     $this->assertFalse(class_exists('Tenside\\CoreBundle\\Annotation\\ApiDescription', false));
     $this->assertTrue(AnnotationRegistry::loadAnnotationClass('Tenside\\CoreBundle\\Annotation\\ApiDescription'));
     $this->assertTrue(class_exists('Tenside\\CoreBundle\\Annotation\\ApiDescription', false));
 }
开发者ID:tenside,项目名称:core-bundle,代码行数:18,代码来源:TensideCoreBundleTest.php

示例2: classExists

 /**
  * Attempt to check if a class exists or not. This never goes through the PHP autoloading mechanism
  * but uses the {@link AnnotationRegistry} to load classes.
  *
  * @param string $fqcn
  * @return boolean
  */
 private function classExists($fqcn)
 {
     if (isset($this->classExists[$fqcn])) {
         return $this->classExists[$fqcn];
     }
     // first check if the class already exists, maybe loaded through another AnnotationReader
     if (class_exists($fqcn, false)) {
         return $this->classExists[$fqcn] = true;
     }
     // final check, does this class exist?
     return $this->classExists[$fqcn] = AnnotationRegistry::loadAnnotationClass($fqcn);
 }
开发者ID:laiello,项目名称:masfletes,代码行数:19,代码来源:DocParser.php

示例3: annotationClass

 /**
  * Get annotation object
  *
  * @param string $name
  *
  * @return object
  * @throws Doctrine\Common\Annotations\AnnotationException
  */
 static function annotationClass($name)
 {
     if (!AnnotationRegistry::loadAnnotationClass($name)) {
         throw new \Doctrine\Common\Annotations\AnnotationException('Annotation ' . $name . ' - not exists');
     }
     return new $name();
 }
开发者ID:vspvt,项目名称:kohana-annotations,代码行数:15,代码来源:Annotations.php


注:本文中的Doctrine\Common\Annotations\AnnotationRegistry::loadAnnotationClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。