Beispiel #1
0
 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__);
 }
 /**
  * @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);
     }
 }
Beispiel #3
0
 /**
  * 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;
 }
 /**
  * @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);
         }
     }
 }
Beispiel #5
0
 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);
 }
Beispiel #6
0
 /**
  * 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();
 }
 /**
  * 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;
 }
 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');
     $configuration->addCustomStringFunction('ST_3DIntersects', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_3DIntersects');
     $configuration->addCustomStringFunction('ST_3DLongestLine', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_3DLongestLine');
     $configuration->addCustomNumericFunction('ST_3DMaxDistance', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_3DMaxDistance');
     $configuration->addCustomStringFunction('ST_3DShortestLine', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_3DShortestLine');
     $configuration->addCustomNumericFunction('ST_Area', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Area');
     $configuration->addCustomNumericFunction('ST_Azimuth', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Azimuth');
     $configuration->addCustomStringFunction('ST_Centroid', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Centroid');
     $configuration->addCustomStringFunction('ST_ClosestPoint', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_ClosestPoint');
     $configuration->addCustomStringFunction('ST_Contains', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Contains');
     $configuration->addCustomStringFunction('ST_ContainsProperly', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_ContainsProperly');
     $configuration->addCustomStringFunction('ST_Covers', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Covers');
     $configuration->addCustomStringFunction('ST_CoveredBy', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_CoveredBy');
     $configuration->addCustomStringFunction('ST_Crosses', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Crosses');
     $configuration->addCustomNumericFunction('ST_LineCrossingDirection', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_LineCrossingDirection');
     $configuration->addCustomStringFunction('ST_Disjoint', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Disjoint');
     $configuration->addCustomNumericFunction('ST_Distance', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Distance');
     $configuration->addCustomNumericFunction('ST_HausdorffDistance', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_HausdorffDistance');
     $configuration->addCustomNumericFunction('ST_MaxDistance', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_MaxDistance');
     $configuration->addCustomNumericFunction('ST_Distance_Sphere', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Distance_Sphere');
     $configuration->addCustomNumericFunction('ST_Distance_Spheroid', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Distance_Spheroid');
     $configuration->addCustomStringFunction('ST_DFullyWithin', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_DFullyWithin');
     $configuration->addCustomStringFunction('ST_DWithin', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_DWithin');
     $configuration->addCustomStringFunction('ST_Equals', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Equals');
     $configuration->addCustomStringFunction('ST_HasArc', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_HasArc');
     $configuration->addCustomStringFunction('ST_Intersects', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Intersects');
     $configuration->addCustomNumericFunction('ST_Length', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Length');
     $configuration->addCustomNumericFunction('ST_3DLength', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_3DLength');
     $configuration->addCustomNumericFunction('ST_Length3D', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Length3D');
     $configuration->addCustomNumericFunction('ST_Length_Spheroid', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Length_Spheroid');
     $configuration->addCustomNumericFunction('ST_Length2D_Spheroid', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Length2D_Spheroid');
     $configuration->addCustomStringFunction('ST_LongestLine', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_LongestLine');
     $configuration->addCustomStringFunction('ST_OrderingEquals', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_OrderingEquals');
     $configuration->addCustomStringFunction('ST_Overlaps', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Overlaps');
     $configuration->addCustomNumericFunction('ST_Perimeter', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Perimeter');
     $configuration->addCustomStringFunction('ST_PointOnSurface', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_PointOnSurface');
     $configuration->addCustomStringFunction('ST_Project', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Project');
     $configuration->addCustomStringFunction('ST_Relate', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Relate');
     $configuration->addCustomStringFunction('ST_ShortestLine', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_ShortestLine');
     $configuration->addCustomStringFunction('ST_Touches', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Touches');
     $configuration->addCustomStringFunction('ST_Within', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Within');
     $configuration->addCustomStringFunction('ST_Buffer', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Buffer');
     $configuration->addCustomStringFunction('ST_Collect', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Collect');
     $configuration->addCustomStringFunction('ST_Difference', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Difference');
     $configuration->addCustomStringFunction('ST_FlipCoordinates', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_FlipCoordinates');
     $configuration->addCustomStringFunction('ST_Intersection', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Intersection');
     $configuration->addCustomStringFunction('ST_MinimumBoundingCircle', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_MinimumBoundingCircle');
     $configuration->addCustomStringFunction('ST_Shift_Longitude', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Shift_Longitude');
     $configuration->addCustomStringFunction('ST_Split', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Split');
     $configuration->addCustomStringFunction('ST_SymDifference', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_SymDifference');
     $configuration->addCustomStringFunction('ST_Union', 'Jsor\\Doctrine\\PostGIS\\Functions\\ST_Union');
 }
 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);
     }
 }
 /**
  * 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 );
     // });
 }