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


PHP Configuration::addCustomNumericFunction方法代码示例

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


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

示例1: testAddGetCustomNumericFunction

 public function testAddGetCustomNumericFunction()
 {
     $this->configuration->addCustomNumericFunction('FunctionName', __CLASS__);
     $this->assertSame(__CLASS__, $this->configuration->getCustomNumericFunction('FunctionName'));
     $this->assertSame(null, $this->configuration->getCustomNumericFunction('NonExistingFunction'));
     $this->configuration->setCustomNumericFunctions(array('OtherFunctionName' => __CLASS__));
     $this->assertSame(__CLASS__, $this->configuration->getCustomNumericFunction('OtherFunctionName'));
     $this->setExpectedException('Doctrine\\ORM\\ORMException');
     $this->configuration->addCustomNumericFunction('abs', __CLASS__);
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:10,代码来源:ConfigurationTest.php

示例2: registerDqlFunction

 /**
  * @param string $type
  * @param string $functionName
  * @param string $functionClass
  * @param Configuration $configuration
  */
 protected function registerDqlFunction($type, $functionName, $functionClass, Configuration $configuration)
 {
     switch ($type) {
         case 'datetime':
             $configuration->addCustomDatetimeFunction($functionName, $functionClass);
             break;
         case 'numeric':
             $configuration->addCustomNumericFunction($functionName, $functionClass);
             break;
         case 'string':
         default:
             $configuration->addCustomStringFunction($functionName, $functionClass);
     }
 }
开发者ID:sergeypererva,项目名称:doctrine-extensions,代码行数:20,代码来源:FunctionsTest.php

示例3: _configureEntityManager

 /**
  * Configure doctrine entity manager
  * 
  * @return Doctrine\ORM\EntityManager
  */
 private function _configureEntityManager()
 {
     global $Campsite;
     $config = new Configuration();
     AnnotationRegistry::registerFile(__DIR__ . '/../../../../vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');
     AnnotationRegistry::registerFile(__DIR__ . '/../../../../vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/Annotations/DoctrineAnnotations.php');
     // set annotations reader
     $reader = new CachedReader(new AnnotationReader(), new $this->options['cache'](), $debug = true);
     $driver = new AnnotationDriver($reader, array(realpath($this->options['entity']['dir'])));
     $config->setMetadataDriverImpl($driver);
     // set proxy
     $config->setProxyDir(realpath($this->options['proxy']['dir']));
     $config->setProxyNamespace($this->options['proxy']['namespace']);
     $config->setAutoGenerateProxyClasses($this->options['proxy']['autogenerate']);
     // set cache
     $cache = new $this->options['cache']();
     $config->setMetadataCacheImpl($cache);
     $config->setQueryCacheImpl($cache);
     $config_file = __DIR__ . '/../../../conf/database_conf.php';
     if (empty($Campsite) && file_exists($config_file)) {
         require_once $config_file;
     }
     // set database
     $database = array('driver' => 'pdo_mysql', 'host' => $Campsite['DATABASE_SERVER_ADDRESS'], 'dbname' => $Campsite['DATABASE_NAME'], 'user' => $Campsite['DATABASE_USER'], 'password' => $Campsite['DATABASE_PASSWORD'], 'charset' => 'UTF8');
     if (isset($this->options['database'])) {
         $database = $this->options['database'];
     }
     foreach ($this->options['functions'] as $function => $value) {
         $config->addCustomNumericFunction(strtoupper($function), $value);
     }
     $this->em = EntityManager::create($database, $config);
     // fix http://wildlyinaccurate.com/doctrine-2-resolving-unknown-database-type-enum-requested
     $platform = $this->em->getConnection()->getDatabasePlatform();
     $platform->registerDoctrineTypeMapping('enum', 'string');
     $platform->registerDoctrineTypeMapping('point', 'string');
     $platform->registerDoctrineTypeMapping('geometry', 'string');
     return $this->em;
 }
开发者ID:nidzix,项目名称:Newscoop,代码行数:43,代码来源:Doctrine.php

示例4: load

 /**
  * @param Configuration $configuration
  * @param string        $database
  */
 public static function load(Configuration $configuration, $database)
 {
     $parser = new Parser();
     // Load the corresponding config file.
     $config = $parser->parse(file_get_contents(realpath(__DIR__ . '/../../config/' . $database . '.yml')));
     $parsed = $config['doctrine']['orm']['dql'];
     // Load the existing function classes.
     if (array_key_exists('datetime_functions', $parsed)) {
         foreach ($parsed['datetime_functions'] as $key => $value) {
             $configuration->addCustomDatetimeFunction(strtoupper($key), $value);
         }
     }
     if (array_key_exists('numeric_functions', $parsed)) {
         foreach ($parsed['numeric_functions'] as $key => $value) {
             $configuration->addCustomNumericFunction(strtoupper($key), $value);
         }
     }
     if (array_key_exists('string_functions', $parsed)) {
         foreach ($parsed['string_functions'] as $key => $value) {
             $configuration->addCustomStringFunction(strtoupper($key), $value);
         }
     }
 }
开发者ID:beberlei,项目名称:DoctrineExtensions,代码行数:27,代码来源:ConfigLoader.php

示例5: createNewEntityManager

 private static function createNewEntityManager()
 {
     $config = new Configuration();
     $driverImpl = $config->newDefaultAnnotationDriver(APPLICATION_PATH . '/Models/Entities');
     $config->setMetadataDriverImpl($driverImpl);
     // 		$config->setMetadataCacheImpl(MyCache::getInstance("_doctrine_metadata")->getCacheImplement());
     // 		$config->setQueryCacheImpl(MyCache::getInstance("_doctrine_query_cache")->getCacheImplement());
     // 		$config->setResultCacheImpl(MyCache::getInstance("_doctrine_result_cache")->getCacheImplement());
     // 		$config->setHydrationCacheImpl(MyCache::getInstance("_doctrine_hydration_cache")->getCacheImplement());
     $config->setMetadataCacheImpl(MyCache::getInstance("_doctrine_cache")->getCacheImplement());
     $config->setQueryCacheImpl(MyCache::getInstance("_doctrine_cache")->getCacheImplement());
     $config->setResultCacheImpl(MyCache::getInstance("_doctrine_cache")->getCacheImplement());
     $config->setHydrationCacheImpl(MyCache::getInstance("_doctrine_cache")->getCacheImplement());
     $config->setProxyDir(APPLICATION_PATH . '/Models/Proxies/__CG__/');
     // 		$config->setProxyDir(APPLICATION_PATH.'/Models/Proxies/__CG__/Models/Entities2');
     $config->setAutoGenerateProxyClasses(AbstractProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS);
     $config->setProxyNamespace('Models\\Proxies\\');
     // 		\My\Doc
     $config->addCustomNumericFunction('RAND', 'My\\Doctrine\\DqlFunction\\Rand');
     // 		$config->setSQLLogger(new MySQLLogger());
     $connectionParams = MyDatabaseConfiguration::getConnectionParam();
     $conn = DriverManager::getConnection($connectionParams);
     return EntityManager::create($conn, $config);
 }
开发者ID:jay45,项目名称:porn,代码行数:24,代码来源:MyEntityManagerFactory.php

示例6: connect

 /**
  * Connect and set-up Doctrine
  *
  * @return void
  */
 public function connect()
 {
     $this->configuration = new \Doctrine\ORM\Configuration();
     // Setup cache
     $this->setDoctrineCache();
     // Set metadata driver
     $chain = new \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain();
     $chain->addDriver($this->createAnnotationDriver(\Includes\Decorator\ADecorator::getCacheModelsDir()), 'XLite\\Model');
     $iterator = new \RecursiveDirectoryIterator(\Includes\Decorator\ADecorator::getCacheClassesDir() . 'XLite' . LC_DS . 'Module', \FilesystemIterator::SKIP_DOTS);
     foreach ($iterator as $dir) {
         if (\Includes\Utils\FileManager::isDir($dir->getPathName())) {
             $iterator2 = new \RecursiveDirectoryIterator($dir->getPathName(), \FilesystemIterator::SKIP_DOTS);
             foreach ($iterator2 as $dir2) {
                 if (\Includes\Utils\FileManager::isDir($dir2->getPathName()) && \Includes\Utils\FileManager::isDir($dir2->getPathName() . LC_DS . 'Model')) {
                     $chain->addDriver($this->createAnnotationDriver($dir2->getPathName() . LC_DS . 'Model'), 'XLite\\Module\\' . $dir->getBaseName() . '\\' . $dir2->getBaseName() . '\\Model');
                 }
             }
         }
     }
     $this->configuration->setMetadataDriverImpl($chain);
     // Set proxy settings
     $this->configuration->setProxyDir(rtrim(\Includes\Decorator\ADecorator::getCacheModelProxiesDir(), LC_DS));
     $this->configuration->setProxyNamespace(LC_MODEL_PROXY_NS);
     $this->configuration->setAutoGenerateProxyClasses(false);
     // Register custom functions
     $this->configuration->addCustomStringFunction('if', '\\XLite\\Core\\Doctrine\\IfFunction');
     $this->configuration->addCustomStringFunction('IFNULL', '\\XLite\\Core\\Doctrine\\IfnullFunction');
     $this->configuration->addCustomStringFunction('relevance', '\\XLite\\Core\\Doctrine\\RelevanceFunction');
     $this->configuration->addCustomNumericFunction('intval', '\\XLite\\Core\\Doctrine\\IntvalFunction');
     $this->configuration->addCustomStringFunction('findInSet', '\\XLite\\Core\\Doctrine\\FindInSetFunction');
     $this->configuration->addCustomStringFunction('castChar', '\\XLite\\Core\\Doctrine\\CastCharFunction');
     $this->configuration->addCustomStringFunction('collate', '\\XLite\\Core\\Doctrine\\CollateFunction');
     $this->tablePrefix = trim(\XLite::getInstance()->getOptions(array('database_details', 'table_prefix')));
     // Initialize DB connection and entity manager
     $this->startEntityManager();
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:41,代码来源:Database.php

示例7: addCustomFunctions

 /**
  * Adds userdefined functions.
  *
  * @param  Configuration $config
  * @param  array         $options
  * @return Configuration
  */
 private static function addCustomFunctions(Configuration $config, array $options = array())
 {
     if (null !== ($strFcts = Collection::get($options, 'orm:entity_managers:default:dql:string_functions'))) {
         foreach ($strFcts as $name => $class) {
             if (class_exists($class)) {
                 $config->addCustomStringFunction($name, $class);
             }
         }
     }
     if (null !== ($numFcts = Collection::get($options, 'orm:entity_managers:default:dql:numeric_functions'))) {
         foreach ($numFcts as $name => $class) {
             if (class_exists($class)) {
                 $config->addCustomNumericFunction($name, $class);
             }
         }
     }
     if (null !== ($datetimeFcts = Collection::get($options, 'orm:entity_managers:default:dql:datetime_functions'))) {
         foreach ($datetimeFcts as $name => $class) {
             if (class_exists($class)) {
                 $config->addCustomDatetimeFunction($name, $class);
             }
         }
     }
     return $config;
 }
开发者ID:mickaelsteinberg,项目名称:BackBee,代码行数:32,代码来源:EntityManagerCreator.php

示例8: configure

 public static function configure(Configuration $configuration)
 {
     $configuration->addCustomStringFunction('ST_Box2dFromGeoHash', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Box2dFromGeoHash');
     $configuration->addCustomStringFunction('ST_GeogFromText', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_GeogFromText');
     $configuration->addCustomStringFunction('ST_GeographyFromText', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_GeographyFromText');
     $configuration->addCustomStringFunction('ST_GeogFromWKB', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_GeogFromWKB');
     $configuration->addCustomStringFunction('ST_GeomCollFromText', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_GeomCollFromText');
     $configuration->addCustomStringFunction('ST_GeomFromEWKB', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_GeomFromEWKB');
     $configuration->addCustomStringFunction('ST_GeomFromEWKT', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_GeomFromEWKT');
     $configuration->addCustomStringFunction('ST_GeomFromGeoHash', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_GeomFromGeoHash');
     $configuration->addCustomStringFunction('ST_GeomFromGML', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_GeomFromGML');
     $configuration->addCustomStringFunction('ST_GeomFromGeoJSON', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_GeomFromGeoJSON');
     $configuration->addCustomStringFunction('ST_GeomFromKML', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_GeomFromKML');
     $configuration->addCustomStringFunction('ST_GeomFromText', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_GeomFromText');
     $configuration->addCustomStringFunction('ST_GeometryFromText', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_GeometryFromText');
     $configuration->addCustomStringFunction('ST_GeomFromWKB', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_GeomFromWKB');
     $configuration->addCustomStringFunction('ST_LineFromMultiPoint', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_LineFromMultiPoint');
     $configuration->addCustomStringFunction('ST_LineFromText', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_LineFromText');
     $configuration->addCustomStringFunction('ST_LineFromWKB', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_LineFromWKB');
     $configuration->addCustomStringFunction('ST_LinestringFromWKB', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_LinestringFromWKB');
     $configuration->addCustomStringFunction('ST_MakeBox2D', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_MakeBox2D');
     $configuration->addCustomStringFunction('ST_3DMakeBox', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_3DMakeBox');
     $configuration->addCustomStringFunction('ST_MakeBox3D', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_MakeBox3D');
     $configuration->addCustomStringFunction('ST_MakeLine', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_MakeLine');
     $configuration->addCustomStringFunction('ST_MakeEnvelope', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_MakeEnvelope');
     $configuration->addCustomStringFunction('ST_MakePolygon', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_MakePolygon');
     $configuration->addCustomStringFunction('ST_MakePoint', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_MakePoint');
     $configuration->addCustomStringFunction('ST_MakePointM', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_MakePointM');
     $configuration->addCustomStringFunction('ST_MLineFromText', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_MLineFromText');
     $configuration->addCustomStringFunction('ST_MPointFromText', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_MPointFromText');
     $configuration->addCustomStringFunction('ST_MPolyFromText', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_MPolyFromText');
     $configuration->addCustomStringFunction('ST_Point', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Point');
     $configuration->addCustomStringFunction('ST_PointFromGeoHash', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_PointFromGeoHash');
     $configuration->addCustomStringFunction('ST_PointFromText', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_PointFromText');
     $configuration->addCustomStringFunction('ST_PointFromWKB', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_PointFromWKB');
     $configuration->addCustomStringFunction('ST_Polygon', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Polygon');
     $configuration->addCustomStringFunction('ST_PolygonFromText', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_PolygonFromText');
     $configuration->addCustomStringFunction('GeometryType', 'Jsor\\Doctrine\\PostGIS\\Functions\\GeometryType');
     $configuration->addCustomStringFunction('ST_Boundary', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Boundary');
     $configuration->addCustomNumericFunction('ST_CoordDim', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_CoordDim');
     $configuration->addCustomNumericFunction('ST_Dimension', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Dimension');
     $configuration->addCustomStringFunction('ST_EndPoint', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_EndPoint');
     $configuration->addCustomStringFunction('ST_Envelope', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Envelope');
     $configuration->addCustomStringFunction('ST_ExteriorRing', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_ExteriorRing');
     $configuration->addCustomStringFunction('ST_GeometryN', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_GeometryN');
     $configuration->addCustomStringFunction('ST_GeometryType', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_GeometryType');
     $configuration->addCustomStringFunction('ST_InteriorRingN', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_InteriorRingN');
     $configuration->addCustomStringFunction('ST_IsClosed', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_IsClosed');
     $configuration->addCustomStringFunction('ST_IsCollection', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_IsCollection');
     $configuration->addCustomStringFunction('ST_IsEmpty', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_IsEmpty');
     $configuration->addCustomStringFunction('ST_IsRing', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_IsRing');
     $configuration->addCustomStringFunction('ST_IsSimple', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_IsSimple');
     $configuration->addCustomStringFunction('ST_IsValid', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_IsValid');
     $configuration->addCustomStringFunction('ST_IsValidReason', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_IsValidReason');
     $configuration->addCustomStringFunction('ST_IsValidDetail', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_IsValidDetail');
     $configuration->addCustomNumericFunction('ST_M', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_M');
     $configuration->addCustomNumericFunction('ST_NDims', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_NDims');
     $configuration->addCustomNumericFunction('ST_NPoints', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_NPoints');
     $configuration->addCustomNumericFunction('ST_NRings', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_NRings');
     $configuration->addCustomNumericFunction('ST_NumGeometries', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_NumGeometries');
     $configuration->addCustomNumericFunction('ST_NumInteriorRings', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_NumInteriorRings');
     $configuration->addCustomNumericFunction('ST_NumInteriorRing', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_NumInteriorRing');
     $configuration->addCustomNumericFunction('ST_NumPatches', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_NumPatches');
     $configuration->addCustomNumericFunction('ST_NumPoints', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_NumPoints');
     $configuration->addCustomStringFunction('ST_PatchN', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_PatchN');
     $configuration->addCustomStringFunction('ST_PointN', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_PointN');
     $configuration->addCustomNumericFunction('ST_SRID', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_SRID');
     $configuration->addCustomStringFunction('ST_StartPoint', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_StartPoint');
     $configuration->addCustomStringFunction('ST_Summary', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Summary');
     $configuration->addCustomNumericFunction('ST_X', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_X');
     $configuration->addCustomNumericFunction('ST_XMax', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_XMax');
     $configuration->addCustomNumericFunction('ST_XMin', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_XMin');
     $configuration->addCustomNumericFunction('ST_Y', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Y');
     $configuration->addCustomNumericFunction('ST_YMax', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_YMax');
     $configuration->addCustomNumericFunction('ST_YMin', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_YMin');
     $configuration->addCustomNumericFunction('ST_Z', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Z');
     $configuration->addCustomNumericFunction('ST_ZMax', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_ZMax');
     $configuration->addCustomNumericFunction('ST_Zmflag', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Zmflag');
     $configuration->addCustomNumericFunction('ST_ZMin', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_ZMin');
     $configuration->addCustomStringFunction('ST_Multi', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Multi');
     $configuration->addCustomStringFunction('ST_Scale', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Scale');
     $configuration->addCustomStringFunction('ST_SetSRID', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_SetSRID');
     $configuration->addCustomStringFunction('ST_Transform', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Transform');
     $configuration->addCustomStringFunction('ST_Translate', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Translate');
     $configuration->addCustomStringFunction('ST_TransScale', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_TransScale');
     $configuration->addCustomStringFunction('ST_AsBinary', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_AsBinary');
     $configuration->addCustomStringFunction('ST_AsEWKB', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_AsEWKB');
     $configuration->addCustomStringFunction('ST_AsEWKT', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_AsEWKT');
     $configuration->addCustomStringFunction('ST_AsGeoJSON', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_AsGeoJSON');
     $configuration->addCustomStringFunction('ST_AsGML', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_AsGML');
     $configuration->addCustomStringFunction('ST_AsHEXEWKB', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_AsHEXEWKB');
     $configuration->addCustomStringFunction('ST_AsKML', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_AsKML');
     $configuration->addCustomStringFunction('ST_AsSVG', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_AsSVG');
     $configuration->addCustomStringFunction('ST_GeoHash', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_GeoHash');
     $configuration->addCustomStringFunction('ST_AsLatLonText', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_AsLatLonText');
     $configuration->addCustomStringFunction('ST_AsText', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_AsText');
     $configuration->addCustomStringFunction('ST_3DClosestPoint', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_3DClosestPoint');
     $configuration->addCustomNumericFunction('ST_3DDistance', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_3DDistance');
     $configuration->addCustomStringFunction('ST_3DDWithin', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_3DDWithin');
     $configuration->addCustomStringFunction('ST_3DDFullyWithin', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_3DDFullyWithin');
//.........这里部分代码省略.........
开发者ID:novikovsergey,项目名称:doctrine-postgis,代码行数:101,代码来源:Configurator.php

示例9: setupCustomFunctions

 protected function setupCustomFunctions(Configuration $config, $spec)
 {
     foreach ($spec['custom_hydration_modes'] as $name => $classname) {
         $config->addCustomHydrationMode($name, $classname);
     }
     foreach ($spec['custom_datetime_functions'] as $name => $classname) {
         $config->addCustomDatetimeFunction($name, $classname);
     }
     foreach ($spec['custom_numeric_functions'] as $name => $classname) {
         $config->addCustomNumericFunction($name, $classname);
     }
     foreach ($spec['custom_string_functions'] as $name => $classname) {
         $config->addCustomStringFunction($name, $classname);
     }
     foreach ($spec['filters'] as $name => $classname) {
         $config->addFilter($name, $classname);
     }
 }
开发者ID:radnan,项目名称:rdn-doctrine,代码行数:18,代码来源:EntityManagerLoader.php

示例10: registerEntityManager

 /**
  * The Entity Manager - why we're all here!
  */
 private function registerEntityManager()
 {
     $this->app->singleton(EntityManagerInterface::class, function ($app) {
         $paths = [Config::get('d2doctrine.paths.entities')];
         $annotations_path = base_path() . '/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php';
         AnnotationRegistry::registerFile($annotations_path);
         $dconfig = new Configuration();
         $reader = new AnnotationReader();
         $driverImpl = new AnnotationDriver($reader, $paths);
         $dconfig->setMetadataDriverImpl($driverImpl);
         $dconfig->setProxyDir(Config::get('d2doctrine.paths.proxies'));
         $dconfig->setProxyNamespace(Config::get('d2doctrine.namespaces.proxies'));
         $dconfig->setAutoGenerateProxyClasses(Config::get('d2doctrine.autogen_proxies'));
         $lconfig = $this->laravelToDoctrineConfigMapper();
         //load prefix listener
         if (isset($lconfig['prefix']) && $lconfig['prefix'] && $lconfig['prefix'] !== '') {
             $tablePrefix = new TablePrefix($lconfig['prefix']);
             $eventManager->addEventListener(Events::loadClassMetadata, $tablePrefix);
         }
         $dconfig->addCustomNumericFunction('SIN', '\\Doctrine2l5\\Query\\Extensions\\Sin');
         $dconfig->addCustomNumericFunction('ASIN', '\\Doctrine2l5\\Query\\Extensions\\Asin');
         $dconfig->addCustomNumericFunction('COS', '\\Doctrine2l5\\Query\\Extensions\\Cos');
         $dconfig->addCustomNumericFunction('ACOS', '\\Doctrine2l5\\Query\\Extensions\\Acos');
         $dconfig->addCustomNumericFunction('RADIANS', '\\Doctrine2l5\\Query\\Extensions\\Radians');
         $dconfig->addCustomNumericFunction('PI', '\\Doctrine2l5\\Query\\Extensions\\Pi');
         $dconfig->addCustomNumericFunction('DEGREES', '\\Doctrine2l5\\Query\\Extensions\\Degrees');
         return EntityManager::create($lconfig, $dconfig);
     });
     // $this->app->singleton( EntityManagerInterface::class, function( $app ) {
     //     $dconfig = new \Doctrine\ORM\Configuration;
     //     $driver = new \Doctrine\ORM\Mapping\Driver\YamlDriver(
     //         array( Config::get( 'd2doctrine.paths.yml' ) )
     //     );
     //     $dconfig->setMetadataDriverImpl( $driver );
     //     $dconfig->setProxyDir(                 Config::get( 'd2doctrine.paths.proxies'      ) );
     //     $dconfig->setProxyNamespace(           Config::get( 'd2doctrine.namespaces.proxies' ) );
     //     $dconfig->setAutoGenerateProxyClasses( Config::get( 'd2doctrine.autogen_proxies'    ) );
     //     $lconfig = $this->laravelToDoctrineConfigMapper();
     //     //load prefix listener
     //     if( isset($lconfig['prefix']) && $lconfig['prefix'] && $lconfig['prefix'] !== '' ) {
     //         $tablePrefix = new TablePrefix( $lconfig['prefix']);
     //         $eventManager->addEventListener(Events::loadClassMetadata, $tablePrefix);
     //     }
     //     return EntityManager::create( $lconfig, $dconfig );
     // });
 }
开发者ID:jeanbelhache,项目名称:doctrine2-l5,代码行数:49,代码来源:Doctrine2ServiceProvider.php


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