本文整理汇总了PHP中Doctrine\Common\Annotations\AnnotationReader::addGlobalIgnoredName方法的典型用法代码示例。如果您正苦于以下问题:PHP AnnotationReader::addGlobalIgnoredName方法的具体用法?PHP AnnotationReader::addGlobalIgnoredName怎么用?PHP AnnotationReader::addGlobalIgnoredName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\Common\Annotations\AnnotationReader
的用法示例。
在下文中一共展示了AnnotationReader::addGlobalIgnoredName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAnnotationReader
/**
* @return AnnotationReader
*/
public static function getAnnotationReader()
{
if (self::$annotationReader !== null) {
return self::$annotationReader;
}
//For old AnnotationReader (<=1.2.7)
//For new (>1.2.7) version of AnnotationReader, we can give a DocParser since a3c2928912eeb5dc5678352f22c378173def16b6
$parser = new DocParser();
$parser->setIgnoreNotImportedAnnotations(true);
self::$annotationReader = new AnnotationReader($parser);
//For old version of AnnotationReader (<=1.2.7) , we have to specify manually all ignored annotations
foreach (self::$ignoredAnnotationNames as $ignoredAnnotationName) {
self::$annotationReader->addGlobalIgnoredName($ignoredAnnotationName);
}
return self::$annotationReader;
}
示例2: __construct
/**
* @DI\InjectParams({
* "dto" = @DI\Inject("servicedto"),
* "entityManager" = @DI\Inject("doctrine.orm.entity_manager"),
* "container" = @DI\Inject("service_container"),
* })
*/
public function __construct(ServiceDto $dto, EntityManager $entityManager = null, $container)
{
AnnotationReader::addGlobalIgnoredName('innerEntity');
$this->setDto($dto);
$this->container = $container;
//Altera parâmetros da conexão
$this->em = $entityManager;
$this->conn = $entityManager->getConnection();
if ($this->checkOracle()) {
//Plataforma personalizada
$this->platform = new SysAllOraclePlatform();
//Schema manager personalizado
$this->scm = new SysAllOracleSchemaManager($this->conn, $this->platform);
} else {
$this->scm = $this->conn->getSchemaManager();
// $this->driver = $entityManager->getConfiguration()->getMetadataDriverImpl();
}
//obtém e define driver utilizado
$this->driver = new DatabaseDriver($this->scm);
$entityManager->getConfiguration()->setMetadataDriverImpl($this->driver);
//realiza a reversa do banco
$this->cmf = new DisconnectedClassMetadataFactory();
$this->cmf->setEntityManager($entityManager);
parent::__construct($dto, $entityManager);
}
示例3: disableValidatorAnnotationForDoctrine
public function disableValidatorAnnotationForDoctrine(Event $e)
{
if (class_exists('Doctrine\\Common\\Annotations\\AnnotationReader')) {
$moduleManager = $e->getTarget();
$config = $moduleManager->getModule('AnnotationValidator')->getConfig();
AnnotationReader::addGlobalIgnoredName($config['validator_annotation']);
}
}
示例4: ignoredAnnotations
/**
* Add a new annotation to the globally ignored annotation names with regard to exception handling.
*/
public function ignoredAnnotations()
{
if (isset($this->configuration['ignores'])) {
$ignores = $this->configuration['ignores'];
if (count($ignores)) {
foreach ($ignores as $ignore) {
AnnotationReader::addGlobalIgnoredName($ignore);
}
}
}
}
示例5: factory
/**
*
* @param array $config
* @return AnnotationReader
*/
public static function factory(array $config)
{
AnnotationRegistry::registerAutoloadNamespaces($config['namespaces']);
$reader = new AnnotationReader();
foreach ($config['ignored_annotations'] as $ignore) {
$reader->addGlobalIgnoredName($ignore);
}
if (is_string($config['cache'])) {
$reader = new CachedReader($reader, new FilesystemCache($config['cache'], 'cache'), $config['cache_debug']);
}
return $reader;
}
示例6: allowAnnotations
/**
* This method will set the docblock annotations that we need Doctrine to ignore.
*
* @codeCoverageIgnore
* @param ClassLoader $loader
*/
public static function allowAnnotations($loader)
{
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
// this will keep the doctrine DocParser from throwing exceptions at our @route annotations in PropelSOA
// enable controllers
$reader = new AnnotationReader();
AnnotationReader::addGlobalIgnoredName('Route');
AnnotationReader::addGlobalIgnoredName('Method');
AnnotationReader::addGlobalIgnoredName('route');
AnnotationReader::addGlobalIgnoredName('QueryParameter');
AnnotationReader::addGlobalIgnoredName('willAccept');
AnnotationReader::addGlobalIgnoredName('wontAccept');
}
示例7: setupReaderAnnotations
/**
* [setupReaderAnnotations description]
* @param array $config
* @return void
*/
private function setupReaderAnnotations($config)
{
/**
* Prepare AnnotationRegistry
*/
AnnotationRegistry::registerFile(__DIR__ . '/../ApiRoute.php');
AnnotationRegistry::registerFile(__DIR__ . '/../ApiRouteSpec.php');
AnnotationReader::addGlobalIgnoredName('persistent');
AnnotationReader::addGlobalIgnoredName('inject');
foreach ($config['ignoreAnnotation'] as $ignore) {
AnnotationReader::addGlobalIgnoredName($ignore);
}
}
示例8: loadConfiguration
public function loadConfiguration()
{
$builder = $this->getContainerBuilder();
$config = $this->getConfig($this->defaults);
$reflectionReader = $builder->addDefinition($this->prefix('reflectionReader'))->setClass('Doctrine\\Common\\Annotations\\AnnotationReader')->setAutowired(FALSE);
Validators::assertField($config, 'ignore', 'array');
foreach ($config['ignore'] as $annotationName) {
$reflectionReader->addSetup('addGlobalIgnoredName', array($annotationName));
AnnotationReader::addGlobalIgnoredName($annotationName);
}
$builder->addDefinition($this->prefix('reader'))->setClass('Doctrine\\Common\\Annotations\\Reader')->setFactory('Doctrine\\Common\\Annotations\\CachedReader', array($this->prefix('@reflectionReader'), Helpers::processCache($this, $config['cache'], 'annotations'), $config['debug']))->setInject(FALSE);
// for runtime
AnnotationRegistry::registerLoader("class_exists");
}
示例9: registerLoader
/**
* @param ClassLoader $loader
* @param string $apps
* @param string $appDir
*/
public static function registerLoader(ClassLoader $loader, &$apps, $appDir)
{
foreach ($apps['apps'] as &$app) {
$namespace = $app['namespace'] . '\\';
$prefixes = $loader->getPrefixesPsr4();
if (isset($prefixes[$namespace])) {
$app['path'] = $prefixes[$namespace][0];
continue;
}
$app['path'] = $loader->getPrefixesPsr4()[$namespace];
}
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
AnnotationReader::addGlobalIgnoredName('noinspection');
AnnotationReader::addGlobalIgnoredName('returns');
}
示例10: factory
/**
* Creates a new entity manager instance based on the passed configuration.
*
* @param \AppserverIo\Psr\Application\ApplicationInterface $application The application instance to create the entity manager for
* @param \AppserverIo\Appserver\Core\Api\Node\PersistenceUnitNodeInterface $persistenceUnitNode The datasource configuration
*
* @return object The entity manager instance
*/
public static function factory(ApplicationInterface $application, PersistenceUnitNodeInterface $persistenceUnitNode)
{
// register additional annotation libraries
foreach ($persistenceUnitNode->getAnnotationRegistries() as $annotationRegistry) {
AnnotationRegistry::registerAutoloadNamespace($annotationRegistry->getNamespace(), $annotationRegistry->getDirectoriesAsArray($application->getWebappPath()));
}
// globally ignore configured annotations to ignore
foreach ($persistenceUnitNode->getIgnoredAnnotations() as $ignoredAnnotation) {
AnnotationReader::addGlobalIgnoredName($ignoredAnnotation->getNodeValue()->__toString());
}
// load the metadata configuration
$metadataConfiguration = $persistenceUnitNode->getMetadataConfiguration();
// prepare the setup properties
$absolutePaths = $metadataConfiguration->getDirectoriesAsArray($application->getWebappPath());
$proxyDir = $metadataConfiguration->getParam(MetadataConfigurationNode::PARAM_PROXY_DIR);
$isDevMode = $metadataConfiguration->getParam(MetadataConfigurationNode::PARAM_IS_DEV_MODE);
$useSimpleAnnotationReader = $metadataConfiguration->getParam(MetadataConfigurationNode::PARAM_USE_SIMPLE_ANNOTATION_READER);
// load the factory method from the available mappings
$factoryMethod = EntityManagerFactory::$metadataMapping[$metadataConfiguration->getType()];
// create the database configuration and initialize the entity manager
$configuration = Setup::$factoryMethod($absolutePaths, $isDevMode, $proxyDir, null, $useSimpleAnnotationReader);
// load the datasource node
$datasourceNode = null;
foreach ($application->getInitialContext()->getSystemConfiguration()->getDatasources() as $datasourceNode) {
if ($datasourceNode->getName() === $persistenceUnitNode->getDatasource()->getName()) {
break;
}
}
// throw a exception if the configured datasource is NOT available
if ($datasourceNode == null) {
throw new \Exception(sprintf('Can\'t find a datasource node for persistence unit %s', $persistenceUnitNode->getName()));
}
// load the database node
$databaseNode = $datasourceNode->getDatabase();
// throw an exception if the configured database is NOT available
if ($databaseNode == null) {
throw new \Exception(sprintf('Can\'t find database node for persistence unit %s', $persistenceUnitNode->getName()));
}
// load the driver node
$driverNode = $databaseNode->getDriver();
// throw an exception if the configured driver is NOT available
if ($driverNode == null) {
throw new \Exception(sprintf('Can\'t find driver node for persistence unit %s', $persistenceUnitNode->getName()));
}
// initialize and return a entity manager decorator instance
return new DoctrineEntityManagerDecorator(EntityManager::create(ConnectionUtil::get($application)->fromDatabaseNode($databaseNode), $configuration));
}
示例11: __construct
public function __construct(array $loaders = array(), array $globalIgnores = array())
{
foreach ($loaders as $loader) {
if (is_object($loader) && method_exists($loader, 'loadClass')) {
// support for composer/symfony's autoloader
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
} elseif (is_callable($loader)) {
AnnotationRegistry::registerLoader($loader);
} elseif (is_array($loader) && is_string($loader[0])) {
AnnotationRegistry::registerAutoloadNamespace($loader[0], $loader[1]);
} elseif (is_array($loader) && is_string(key($loader))) {
AnnotationRegistry::registerAutoloadNamespace(key($loader), reset($loader));
} elseif (is_string($loader)) {
AnnotationRegistry::registerFile($loader);
} else {
throw new \LogicException('Not a valid Annotation loader. Must be a Composer Autoloader instance, a callable, a array with namespace/path format or a string with path to a register file');
}
}
foreach ($globalIgnores as $annotation) {
AnnotationReader::addGlobalIgnoredName($annotation);
}
}
示例12: dispatch
/**
* Dispatch a remote method call.
*
* @param Hatimeria\ExtJSBundle\Router\Call $call
* @return Mixed
*/
private function dispatch($call)
{
$controller = $this->resolveController($call->getAction());
$method = $call->getMethod() . "Action";
\Doctrine\Common\Annotations\AnnotationReader::addGlobalIgnoredName("remote");
\Doctrine\Common\Annotations\AnnotationReader::addGlobalIgnoredName("form");
$event = new FilterControllerEvent($this->container->get("kernel"), array($controller, $method), $this->container->get('request'), 'GET');
$listener = $this->container->get("security.extra.controller_listener");
$listener->onCoreController($event);
$controller = $event->getController();
if (!is_callable($controller)) {
throw new ExtJSException(sprintf("Controller %s method %s is not callable", get_class($controller), $method));
}
try {
if ($controller instanceof \Closure) {
$response = $controller($call->getParams(), $this->request->getFiles());
} else {
$response = $controller[0]->{$method}($call->getParams(), $this->request->getFiles());
}
// default behavior - everything went fine
if ($response == null) {
$response = new Success();
}
if (is_object($response)) {
if ($response instanceof ResponseInterface) {
$response = $response->toArray();
} else {
$response = $this->container->get('hatimeria_extjs.dumper')->dump($response)->toArray();
}
}
$result = $call->getResponse($response);
} catch (NotFoundHttpException $e) {
$result = $call->getResponse(array('success' => false, 'exception' => true, 'code' => $e->getStatusCode(), 'msg' => $e->getMessage()));
} catch (AccessDeniedException $e) {
$result = $call->getResponse(array('success' => false, 'exception' => true, 'code' => $e->getCode(), 'msg' => $e->getMessage(), 'anonymous' => $this->container->get('security.context')->getToken() instanceof AnonymousToken));
}
return $result;
}
示例13: createAnnotationReader
/**
* Gibt einen neuen SimpleAnnotationReader zurück
*
* der Namespace Doctrine\ORM\Mapping wird automatisch hinzugefügt
* es wird der interne Cache benutzt
* @return Doctrine\Common\Annotations\SimpleAnnotationReader()
*/
public function createAnnotationReader($simple = TRUE, array $ignoredAnnotations = array())
{
if ($simple) {
$reader = new \Doctrine\Common\Annotations\SimpleAnnotationReader();
$reader->addNamespace('Doctrine\\ORM\\Mapping');
} else {
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
}
foreach ($ignoredAnnotations as $ignore) {
$reader->addGlobalIgnoredName($ignore);
}
$reader = new \Doctrine\Common\Annotations\CachedReader($reader, $this->getCache());
return $reader;
}
示例14: bootstrap
/**
* Lädt alle für Doctrine wichtigen Klassen und Objekte
*
*/
public function bootstrap($bootFlags = 0x0)
{
if (!isset($this->configuration)) {
$this->configuration = new Configuration();
}
/* Custom Functions */
$this->configuration->addCustomDatetimeFunction('month', 'Psc\\Doctrine\\Functions\\Month');
$this->configuration->addCustomDatetimeFunction('year', 'Psc\\Doctrine\\Functions\\Year');
$this->configuration->addCustomDatetimeFunction('day', 'Psc\\Doctrine\\Functions\\Day');
$this->configuration->addCustomStringFunction('soundex', 'Psc\\Doctrine\\Functions\\Soundex');
/* Annotations */
// Register the ORM Annotations in the AnnotationRegistry
AnnotationRegistry::registerFile($this->project->dir('vendor')->getFile('doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'));
\Doctrine\Common\Annotations\AnnotationReader::addGlobalIgnoredName('chainable');
if (!isset($this->driverChain)) {
$this->driverChain = new MappingDriverChain();
}
$this->driverChain->addDriver($this->getAnnotationDriver(), $this->entitiesNamespace);
$this->configuration->setMetadataDriverImpl($this->driverChain);
// Metadatadriver für einzelne Entities
$this->registerEntityClassesMetadataDriver(array(), 'Psc', $this->getDefaultAnnotationReader());
/* Ci-Ca-Caches */
if (($cache = $this->project->getConfiguration()->get('doctrine.cache')) != NULL) {
$this->useCache($cache);
}
$this->configuration->setMetadataCacheImpl($this->getCache());
$this->configuration->setQueryCacheImpl($this->getCache());
$this->configuration->setResultCacheImpl($this->getResultCache());
// das ist wichtig, damit dieselben abfragen pro result gecached werden
$this->configuration->setProxyDir($this->project->dir('cache')->sub('Proxies/')->create());
$this->configuration->setProxyNamespace('Proxies');
$this->configuration->setAutoGenerateProxyClasses(TRUE);
$this->registerDefaultTypes();
$this->registerCustomTypes();
$this->dispatchBootstrapped();
return $this;
}
示例15: init
/**
* Initializes the application instance.
*
* This method
* starts the session,
* call Slim constructor,
* set the custom log writer (if is defined in config),
* bootstraps the Doctrine,
* bootstraps the Auth Manager,
* creates the cache and rcache components,
* sets the file storage,
* adds midlewares,
* instantiates the Route Manager and
* includes the theme.php file of the active theme if the file exists.
*
*
* If the application was previously initiated, this method returns the application in the first line.
*
* @return \MapasCulturais\App
*/
public function init($config = array())
{
if ($this->_initiated) {
return $this;
}
$this->_initiated = true;
if ($config['slim.debug']) {
error_reporting(E_ALL ^ E_STRICT);
}
session_start();
$config['app.mode'] = key_exists('app.mode', $config) ? $config['app.mode'] : 'production';
$this->_config = $config;
$this->_config['path.layouts'] = APPLICATION_PATH . 'themes/active/layouts/';
$this->_config['path.templates'] = APPLICATION_PATH . 'themes/active/views/';
$this->_config['path.metadata_inputs'] = APPLICATION_PATH . 'themes/active/metadata-inputs/';
if (!key_exists('app.sanitize_filename_function', $this->_config)) {
$this->_config['app.sanitize_filename_function'] = null;
}
parent::__construct(array('log.level' => $config['slim.log.level'], 'log.enabled' => $config['slim.log.enabled'], 'debug' => $config['slim.debug'], 'templates.path' => $this->_config['path.templates'], 'view' => new View(), 'mode' => $this->_config['app.mode']));
$config = $this->_config;
// custom log writer
if (isset($config['slim.log.writer']) && is_object($config['slim.log.writer']) && method_exists($config['slim.log.writer'], 'write')) {
$log = $this->getLog();
$log->setWriter($config['slim.log.writer']);
}
// =============== CACHE =============== //
if (key_exists('app.cache', $config) && is_object($config['app.cache']) && is_subclass_of($config['app.cache'], '\\Doctrine\\Common\\Cache\\CacheProvider')) {
$this->_cache = $config['app.cache'];
} else {
$this->_cache = new \Doctrine\Common\Cache\ArrayCache();
}
// creates runtime cache component
$this->_rcache = new \Doctrine\Common\Cache\ArrayCache();
// ===================================== //
// ========== BOOTSTRAPING DOCTRINE ========== //
// annotation driver
$doctrine_config = Setup::createConfiguration($config['doctrine.isDev']);
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
$classLoader->register();
$driver = new AnnotationDriver(new AnnotationReader());
$driver->addPaths(array(__DIR__ . '/Entities/'));
// tells the doctrine to ignore hook annotation.
AnnotationReader::addGlobalIgnoredName('hook');
// driver must be pdo_pgsql
$config['doctrine.database']['driver'] = 'pdo_pgsql';
// registering noop annotation autoloader - allow all annotations by default
AnnotationRegistry::registerLoader('class_exists');
$doctrine_config->setMetadataDriverImpl($driver);
$proxy_dir = APPLICATION_PATH . 'lib/MapasCulturais/DoctrineProxies';
$proxy_namespace = 'MapasCulturais\\DoctrineProxies';
$doctrine_config->setProxyDir($proxy_dir);
$doctrine_config->setProxyNamespace($proxy_namespace);
\Doctrine\ORM\Proxy\Autoloader::register($proxy_dir, $proxy_namespace);
/** DOCTRINE2 SPATIAL */
$doctrine_config->addCustomStringFunction('st_asbinary', 'CrEOF\\Spatial\\ORM\\Query\\AST\\Functions\\PostgreSql\\STAsBinary');
$doctrine_config->addCustomStringFunction('st_astext', 'CrEOF\\Spatial\\ORM\\Query\\AST\\Functions\\PostgreSql\\STAsText');
$doctrine_config->addCustomNumericFunction('st_area', 'CrEOF\\Spatial\\ORM\\Query\\AST\\Functions\\PostgreSql\\STArea');
$doctrine_config->addCustomStringFunction('st_centroid', 'CrEOF\\Spatial\\ORM\\Query\\AST\\Functions\\PostgreSql\\STCentroid');
$doctrine_config->addCustomStringFunction('st_closestpoint', 'CrEOF\\Spatial\\ORM\\Query\\AST\\Functions\\PostgreSql\\STClosestPoint');
$doctrine_config->addCustomNumericFunction('st_contains', 'CrEOF\\Spatial\\ORM\\Query\\AST\\Functions\\PostgreSql\\STContains');
$doctrine_config->addCustomNumericFunction('st_containsproperly', 'CrEOF\\Spatial\\ORM\\Query\\AST\\Functions\\PostgreSql\\STContainsProperly');
$doctrine_config->addCustomNumericFunction('st_covers', 'CrEOF\\Spatial\\ORM\\Query\\AST\\Functions\\PostgreSql\\STCovers');
$doctrine_config->addCustomNumericFunction('st_coveredby', 'CrEOF\\Spatial\\ORM\\Query\\AST\\Functions\\PostgreSql\\STCoveredBy');
$doctrine_config->addCustomNumericFunction('st_crosses', 'CrEOF\\Spatial\\ORM\\Query\\AST\\Functions\\PostgreSql\\STCrosses');
$doctrine_config->addCustomNumericFunction('st_disjoint', 'CrEOF\\Spatial\\ORM\\Query\\AST\\Functions\\PostgreSql\\STDisjoint');
$doctrine_config->addCustomNumericFunction('st_distance', 'CrEOF\\Spatial\\ORM\\Query\\AST\\Functions\\PostgreSql\\STDistance');
$doctrine_config->addCustomStringFunction('st_envelope', 'CrEOF\\Spatial\\ORM\\Query\\AST\\Functions\\PostgreSql\\STEnvelope');
$doctrine_config->addCustomStringFunction('st_geomfromtext', 'CrEOF\\Spatial\\ORM\\Query\\AST\\Functions\\PostgreSql\\STGeomFromText');
$doctrine_config->addCustomNumericFunction('st_length', 'CrEOF\\Spatial\\ORM\\Query\\AST\\Functions\\PostgreSql\\STLength');
$doctrine_config->addCustomNumericFunction('st_linecrossingdirection', 'CrEOF\\Spatial\\ORM\\Query\\AST\\Functions\\PostgreSql\\STLineCrossingDirection');
$doctrine_config->addCustomStringFunction('st_startpoint', 'CrEOF\\Spatial\\ORM\\Query\\AST\\Functions\\PostgreSql\\STStartPoint');
$doctrine_config->addCustomStringFunction('st_summary', 'CrEOF\\Spatial\\ORM\\Query\\AST\\Functions\\PostgreSql\\STSummary');
$doctrine_config->addCustomStringFunction('string_agg', 'MapasCulturais\\DoctrineMappings\\Functions\\StringAgg');
$doctrine_config->addCustomStringFunction('unaccent', 'MapasCulturais\\DoctrineMappings\\Functions\\Unaccent');
$doctrine_config->addCustomStringFunction('recurring_event_occurrence_for', 'MapasCulturais\\DoctrineMappings\\Functions\\RecurringEventOcurrenceFor');
$doctrine_config->addCustomNumericFunction('st_dwithin', 'MapasCulturais\\DoctrineMappings\\Functions\\STDWithin');
$doctrine_config->addCustomNumericFunction('st_makepoint', 'MapasCulturais\\DoctrineMappings\\Functions\\STMakePoint');
$doctrine_config->setQueryCacheImpl($this->_cache);
// obtaining the entity manager
$this->_em = EntityManager::create($config['doctrine.database'], $doctrine_config);
//.........这里部分代码省略.........