本文整理匯總了PHP中Doctrine\ORM\Configuration::setEntityNamespaces方法的典型用法代碼示例。如果您正苦於以下問題:PHP Configuration::setEntityNamespaces方法的具體用法?PHP Configuration::setEntityNamespaces怎麽用?PHP Configuration::setEntityNamespaces使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\ORM\Configuration
的用法示例。
在下文中一共展示了Configuration::setEntityNamespaces方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSetGetEntityNamespace
public function testSetGetEntityNamespace()
{
$this->configuration->addEntityNamespace('TestNamespace', __NAMESPACE__);
$this->assertSame(__NAMESPACE__, $this->configuration->getEntityNamespace('TestNamespace'));
$namespaces = array('OtherNamespace' => __NAMESPACE__);
$this->configuration->setEntityNamespaces($namespaces);
$this->assertSame($namespaces, $this->configuration->getEntityNamespaces());
$this->setExpectedException('Doctrine\\ORM\\ORMException');
$this->configuration->getEntityNamespace('NonExistingNamespace');
}
示例2: createService
public function createService(ServiceLocatorInterface $serviceLocator)
{
/** @var $options \DoctrineORMModule\Options\Configuration */
$options = $this->getOptions($serviceLocator);
$config = new Configuration();
$config->setAutoGenerateProxyClasses($options->getGenerateProxies());
$config->setProxyDir($options->getProxyDir());
$config->setProxyNamespace($options->getProxyNamespace());
$config->setEntityNamespaces($options->getEntityNamespaces());
$config->setCustomDatetimeFunctions($options->getDatetimeFunctions());
$config->setCustomStringFunctions($options->getStringFunctions());
$config->setCustomNumericFunctions($options->getNumericFunctions());
$config->setClassMetadataFactoryName($options->getClassMetadataFactoryName());
foreach ($options->getNamedQueries() as $name => $query) {
$config->addNamedQuery($name, $query);
}
foreach ($options->getNamedNativeQueries() as $name => $query) {
$config->addNamedNativeQuery($name, $query['sql'], new $query['rsm']());
}
foreach ($options->getCustomHydrationModes() as $modeName => $hydrator) {
$config->addCustomHydrationMode($modeName, $hydrator);
}
foreach ($options->getFilters() as $name => $class) {
$config->addFilter($name, $class);
}
$config->setMetadataCacheImpl($serviceLocator->get($options->getMetadataCache()));
$config->setQueryCacheImpl($serviceLocator->get($options->getQueryCache()));
$config->setResultCacheImpl($serviceLocator->get($options->getResultCache()));
$config->setHydrationCacheImpl($serviceLocator->get($options->getHydrationCache()));
$config->setMetadataDriverImpl($serviceLocator->get($options->getDriver()));
if ($namingStrategy = $options->getNamingStrategy()) {
if (is_string($namingStrategy)) {
if (!$serviceLocator->has($namingStrategy)) {
throw new InvalidArgumentException(sprintf('Naming strategy "%s" not found', $namingStrategy));
}
$config->setNamingStrategy($serviceLocator->get($namingStrategy));
} else {
$config->setNamingStrategy($namingStrategy);
}
}
if ($repositoryFactory = $options->getRepositoryFactory()) {
if (is_string($repositoryFactory)) {
if (!$serviceLocator->has($repositoryFactory)) {
throw new InvalidArgumentException(sprintf('Repository factory "%s" not found', $repositoryFactory));
}
$config->setRepositoryFactory($serviceLocator->get($repositoryFactory));
} else {
$config->setRepositoryFactory($repositoryFactory);
}
}
if ($entityListenerResolver = $options->getEntityListenerResolver()) {
if ($entityListenerResolver instanceof EntityListenerResolver) {
$config->setEntityListenerResolver($entityListenerResolver);
} else {
$config->setEntityListenerResolver($serviceLocator->get($entityListenerResolver));
}
}
$this->setupDBALConfiguration($serviceLocator, $config);
return $config;
}
示例3: createTestConfiguration
/**
* @return Configuration
*/
public static function createTestConfiguration()
{
$config = new Configuration();
$config->setEntityNamespaces(array('SymfonyTestsDoctrine' => 'Symfony\\Bridge\\Doctrine\\Tests\\Fixtures'));
$config->setAutoGenerateProxyClasses(true);
$config->setProxyDir(\sys_get_temp_dir());
$config->setProxyNamespace('SymfonyTests\\Doctrine');
$config->setMetadataDriverImpl(new AnnotationDriver(new AnnotationReader()));
$config->setQueryCacheImpl(new ArrayCache());
$config->setMetadataCacheImpl(new ArrayCache());
return $config;
}
示例4: createEntityManager
/**
* Creates the EntityManager instance.
*
* @return \Doctrine\ORM\EntityManager
*/
protected static function createEntityManager()
{
$config = new DoctrineConfiguration();
// entity namespaces for the test environment
$namespaces = array('BedRest\\TestFixtures\\Models\\Company' => TESTS_BASEDIR . '/BedRest/TestFixtures/Models/Company/');
$config->setEntityNamespaces(array_keys($namespaces));
// basic Proxy config
$config->setProxyDir(TESTS_BASEDIR . '/BedRest/TestFixtures/Proxies');
$config->setProxyNamespace('BedRest\\TestFixtures\\Proxies');
// ArrayCache, to avoid persistent caching in test environment
$config->setMetadataCacheImpl(new ArrayCache());
// basic AnnotationDriver configuration for parsing Doctrine annotations
$metaDriver = new AnnotationDriver(new AnnotationReader());
$metaDriver->addPaths(array_values($namespaces));
$config->setMetadataDriverImpl($metaDriver);
// create the EntityManager
$connectionOptions = array('driver' => 'pdo_sqlite', 'path' => TESTS_BASEDIR . '/test_db.sqlite');
$em = EntityManager::create($connectionOptions, $config);
self::$doctrineEntityManager = $em;
}
示例5: gerEntityManager
public static function gerEntityManager()
{
$loader1 = new ClassLoader('Models', __DIR__ . '/../Models');
$loader1->register();
$loader2 = new ClassLoader('ModelsProxy', __DIR__ . '/../Models');
$loader2->register();
//Configuration
$config = new Configuration();
$cache = new Cache();
$config->setQueryCacheImpl($cache);
$config->setProxyDir(__DIR__ . '/../Models');
$config->setProxyNamespace('ModelsProxy');
$config->setEntityNamespaces(array('Models'));
$config->setAutoGenerateProxyClasses(TRUE);
AnnotationRegistry::registerFile(__DIR__ . "/../../vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php");
$driver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver(new \Doctrine\Common\Annotations\AnnotationReader(), array(__DIR__ . '/../Models'));
$config->setMetadataDriverImpl($driver);
$config->setMetadataCacheImpl($cache);
$dbConf = self::getDataBaseParams();
//getting EntityManager
$entityManager = EntityManager::create($dbConf, $config);
return $entityManager;
}
示例6: __invoke
/**
* {@inheritDoc}
*
* @return Configuration
*/
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
/** @var $options \DoctrineORMModule\Options\Configuration */
$options = $this->getOptions($container);
$config = new Configuration();
$config->setAutoGenerateProxyClasses($options->getGenerateProxies());
$config->setProxyDir($options->getProxyDir());
$config->setProxyNamespace($options->getProxyNamespace());
$config->setEntityNamespaces($options->getEntityNamespaces());
$config->setCustomDatetimeFunctions($options->getDatetimeFunctions());
$config->setCustomStringFunctions($options->getStringFunctions());
$config->setCustomNumericFunctions($options->getNumericFunctions());
$config->setClassMetadataFactoryName($options->getClassMetadataFactoryName());
foreach ($options->getNamedQueries() as $name => $query) {
$config->addNamedQuery($name, $query);
}
foreach ($options->getNamedNativeQueries() as $name => $query) {
$config->addNamedNativeQuery($name, $query['sql'], new $query['rsm']());
}
foreach ($options->getCustomHydrationModes() as $modeName => $hydrator) {
$config->addCustomHydrationMode($modeName, $hydrator);
}
foreach ($options->getFilters() as $name => $class) {
$config->addFilter($name, $class);
}
$config->setMetadataCacheImpl($container->get($options->getMetadataCache()));
$config->setQueryCacheImpl($container->get($options->getQueryCache()));
$config->setResultCacheImpl($container->get($options->getResultCache()));
$config->setHydrationCacheImpl($container->get($options->getHydrationCache()));
$config->setMetadataDriverImpl($container->get($options->getDriver()));
if ($namingStrategy = $options->getNamingStrategy()) {
if (is_string($namingStrategy)) {
if (!$container->has($namingStrategy)) {
throw new InvalidArgumentException(sprintf('Naming strategy "%s" not found', $namingStrategy));
}
$config->setNamingStrategy($container->get($namingStrategy));
} else {
$config->setNamingStrategy($namingStrategy);
}
}
if ($quoteStrategy = $options->getQuoteStrategy()) {
if (is_string($quoteStrategy)) {
if (!$container->has($quoteStrategy)) {
throw new InvalidArgumentException(sprintf('Quote strategy "%s" not found', $quoteStrategy));
}
$config->setQuoteStrategy($container->get($quoteStrategy));
} else {
$config->setQuoteStrategy($quoteStrategy);
}
}
if ($repositoryFactory = $options->getRepositoryFactory()) {
if (is_string($repositoryFactory)) {
if (!$container->has($repositoryFactory)) {
throw new InvalidArgumentException(sprintf('Repository factory "%s" not found', $repositoryFactory));
}
$config->setRepositoryFactory($container->get($repositoryFactory));
} else {
$config->setRepositoryFactory($repositoryFactory);
}
}
if ($entityListenerResolver = $options->getEntityListenerResolver()) {
if ($entityListenerResolver instanceof EntityListenerResolver) {
$config->setEntityListenerResolver($entityListenerResolver);
} else {
$config->setEntityListenerResolver($container->get($entityListenerResolver));
}
}
$secondLevelCache = $options->getSecondLevelCache();
if ($secondLevelCache->isEnabled()) {
$regionsConfig = new RegionsConfiguration($secondLevelCache->getDefaultLifetime(), $secondLevelCache->getDefaultLockLifetime());
foreach ($secondLevelCache->getRegions() as $regionName => $regionConfig) {
if (isset($regionConfig['lifetime'])) {
$regionsConfig->setLifetime($regionName, $regionConfig['lifetime']);
}
if (isset($regionConfig['lock_lifetime'])) {
$regionsConfig->setLockLifetime($regionName, $regionConfig['lock_lifetime']);
}
}
// As Second Level Cache caches queries results, we reuse the result cache impl
$cacheFactory = new DefaultCacheFactory($regionsConfig, $config->getResultCacheImpl());
$cacheFactory->setFileLockRegionDirectory($secondLevelCache->getFileLockRegionDirectory());
$cacheConfiguration = new CacheConfiguration();
$cacheConfiguration->setCacheFactory($cacheFactory);
$cacheConfiguration->setRegionsConfiguration($regionsConfig);
$config->setSecondLevelCacheEnabled();
$config->setSecondLevelCacheConfiguration($cacheConfiguration);
}
if ($className = $options->getDefaultRepositoryClassName()) {
$config->setDefaultRepositoryClassName($className);
}
$this->setupDBALConfiguration($container, $config);
return $config;
}
示例7: createWithConfig
/**
* {@inheritdoc}
*/
protected function createWithConfig(ContainerInterface $container, $configKey)
{
$config = $this->retrieveConfig($container, $configKey, 'configuration');
$configuration = new Configuration();
$configuration->setProxyDir($config['proxy_dir']);
$configuration->setProxyNamespace($config['proxy_namespace']);
$configuration->setAutoGenerateProxyClasses($config['auto_generate_proxy_classes']);
$configuration->setEntityNamespaces($config['entity_namespaces']);
$configuration->setCustomDatetimeFunctions($config['datetime_functions']);
$configuration->setCustomStringFunctions($config['string_functions']);
$configuration->setCustomNumericFunctions($config['numeric_functions']);
$configuration->setCustomHydrationModes($config['custom_hydration_modes']);
$configuration->setClassMetadataFactoryName($config['class_metadata_factory_name']);
foreach ($config['named_queries'] as $name => $dql) {
$configuration->addNamedQuery($name, $dql);
}
foreach ($config['named_native_queries'] as $name => $query) {
$configuration->addNamedNativeQuery($name, $query['sql'], $query['rsm']);
}
foreach ($config['filters'] as $name => $className) {
$configuration->addFilter($name, $className);
}
$configuration->setMetadataCacheImpl($this->retrieveDependency($container, $config['metadata_cache'], 'cache', CacheFactory::class));
$configuration->setQueryCacheImpl($this->retrieveDependency($container, $config['query_cache'], 'cache', CacheFactory::class));
$configuration->setResultCacheImpl($this->retrieveDependency($container, $config['result_cache'], 'cache', CacheFactory::class));
$configuration->setHydrationCacheImpl($this->retrieveDependency($container, $config['hydration_cache'], 'cache', CacheFactory::class));
$configuration->setMetadataDriverImpl($this->retrieveDependency($container, $config['driver'], 'driver', DriverFactory::class));
if (is_string($config['naming_strategy'])) {
$configuration->setNamingStrategy($container->get($config['naming_strategy']));
} elseif (null !== $config['naming_strategy']) {
$configuration->setNamingStrategy($config['naming_strategy']);
}
if (is_string($config['repository_factory'])) {
$configuration->setRepositoryFactory($container->get($config['repository_factory']));
} elseif (null !== $config['repository_factory']) {
$configuration->setRepositoryFactory($config['repository_factory']);
}
if (is_string($config['entity_listener_resolver'])) {
$configuration->setEntityListenerResolver($container->get($config['entity_listener_resolver']));
} elseif (null !== $config['entity_listener_resolver']) {
$configuration->setEntityListenerResolver($config['entity_listener_resolver']);
}
if (null !== $config['default_repository_class_name']) {
$configuration->setDefaultRepositoryClassName($config['default_repository_class_name']);
}
if ($config['second_level_cache']['enabled']) {
$regionsConfig = new RegionsConfiguration($config['second_level_cache']['default_lifetime'], $config['second_level_cache']['default_lock_lifetime']);
foreach ($config['second_level_cache']['regions'] as $regionName => $regionConfig) {
if (array_key_exists('lifetime', $regionConfig)) {
$regionsConfig->setLifetime($regionName, $regionConfig['lifetime']);
}
if (array_key_exists('lock_lifetime', $regionConfig)) {
$regionsConfig->setLockLifetime($regionName, $regionConfig['lock_lifetime']);
}
}
$cacheFactory = new DefaultCacheFactory($regionsConfig, $configuration->getResultCacheImpl());
$cacheFactory->setFileLockRegionDirectory($config['second_level_cache']['file_lock_region_directory']);
$cacheConfiguration = new CacheConfiguration();
$cacheConfiguration->setCacheFactory($cacheFactory);
$cacheConfiguration->setRegionsConfiguration($regionsConfig);
$configuration->setSecondLevelCacheEnabled(true);
$configuration->setSecondLevelCacheConfiguration($cacheConfiguration);
}
if (is_string($config['sql_logger'])) {
$configuration->setSQLLogger($container->get($config['sql_logger']));
} elseif (null !== $config['sql_logger']) {
$configuration->setSQLLogger($config['sql_logger']);
}
return $configuration;
}
示例8: initializeDoctrine
/**
* Initializes the doctrine framework and
* sets all required configuration options.
*
* @param none
* @return nothing
*/
public static function initializeDoctrine () {
$config = new Configuration;
$driverImpl = $config->newDefaultAnnotationDriver(
array(__DIR__)
//array(__DIR__."/Session")
);
$config->setMetadataDriverImpl($driverImpl);
$connectionOptions = array(
'driver' => PartKeeprConfiguration::getOption("partkeepr.database.driver","pdo_mysql"),
'dbname' => PartKeeprConfiguration::getOption("partkeepr.database.dbname", "partkeepr"),
'user' => PartKeeprConfiguration::getOption("partkeepr.database.username", "partkeepr"),
'password' => PartKeeprConfiguration::getOption("partkeepr.database.password", "partkeepr"),
'host' => PartKeeprConfiguration::getOption("partkeepr.database.hostname", "localhost")
);
$cache = new \Doctrine\Common\Cache\ApcCache();
$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);
$config->setProxyDir(dirname(dirname(dirname(__DIR__))) . '/Proxies');
$config->setProxyNamespace('Proxies');
$config->setEntityNamespaces(self::getEntityClasses());
$config->setAutoGenerateProxyClasses(false);
if (PartKeeprConfiguration::getOption("partkeepr.database.echo_sql_log", false) === true) {
$logger = new \Doctrine\DBAL\Logging\EchoSQLLogger();
$config->setSQLLogger($logger);
}
self::$entityManager = EntityManager::create($connectionOptions, $config);
}
示例9: loadInstance
/**
* {@inheritDoc}
*/
protected function loadInstance()
{
$opts = $this->opts;
$config = new DoctrineConfiguration();
// proxies
$config->setAutoGenerateProxyClasses($opts['auto_generate_proxies']);
$config->setProxyDir($opts['proxy_dir']);
$config->setProxyNamespace($opts['proxy_namespace']);
// entity namespaces
$config->setEntityNamespaces($opts['entity_namespaces']);
// add custom functions
$config->setCustomDatetimeFunctions($opts['custom_datetime_functions']);
$config->setCustomStringFunctions($opts['custom_string_functions']);
$config->setCustomNumericFunctions($opts['custom_numeric_functions']);
// custom queries
foreach ($opts['named_queries'] as $query) {
$config->addNamedQuery($query['name'], $query['dql']);
}
foreach ($opts['named_native_queries'] as $query) {
$config->addNamedNativeQuery($query['name'], $query['sql'], new $query['rsm']());
}
// caching
$config->setQueryCacheImpl($this->queryCache);
$config->setMetadataCacheImpl($this->metadataCache);
$config->setResultCacheImpl($this->metadataCache);
// logger
$config->setSQLLogger($this->logger);
// finally, the driver
$config->setMetadataDriverImpl($this->metadataDriver);
$this->instance = $config;
}
示例10: _initDoctrine
protected function _initDoctrine()
{
$appDoctrineConfig = $this->getOption('doctrine');
$classLoader = new DoctrineClassLoader('Doctrine');
$classLoader->setIncludePath(realpath(APPLICATION_PATH . '/../library'));
$classLoader->register();
$config = new DoctrineConfiguration();
if (isset($appDoctrineConfig['cache'])) {
switch ($appDoctrineConfig['cache']) {
case 'array':
$cache = new DoctrineArrayCache();
break;
case 'apc':
$cache = new DoctrineApcCache();
break;
}
$config->setQueryCacheImpl($cache);
$config->setMetadataCacheImpl($cache);
}
$proxyDir = empty($appDoctrineConfig['proxyDir']) ? APPLICATION_PATH . '/../library/Orm/Proxies' : $appDoctrineConfig['proxyDir'];
$config->setProxyDir(realpath($proxyDir));
$config->setProxyNamespace('Orm\\Proxies');
$config->setAutoGenerateProxyClasses(false);
$config->setEntityNamespaces(array('Orm\\Entity'));
$config->setMetadataDriverImpl(new \Doctrine\ORM\Mapping\Driver\StaticPHPDriver(realpath(APPLICATION_PATH . '/../library/Orm/Entity')));
//$config->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());
$config->setSQLLogger(null);
$db = $this->getResource('db');
$dbConfig = $db->getConfig();
$connectionOptions = array('pdo' => $db->getConnection(), 'dbname' => $dbConfig['dbname']);
$entityManager = DoctrineEntityManager::create($connectionOptions, $config);
$entityManager->getConnection()->getConfiguration()->setSQLLogger(null);
Registry::setEntityManager($entityManager);
return $entityManager;
}
示例11: configuracion
/**
* Entidades::configuracion()
*
* Genera el proceso de configuracion y preparacion
* de los directorios de las entidades
*
* @return object
*/
private function configuracion()
{
$confg = new Configuration();
$confg->setMetadataDriverImpl($confg->newDefaultAnnotationDriver($this->dirEntidades));
$confg->setMetadataCacheImpl(new ArrayCache());
$confg->setProxyDir($this->dirProxy);
$confg->setProxyNamespace('Proxy');
$confg->setAutoGenerateProxyClasses(true);
$confg->setEntityNamespaces(array('Entidades\\' . $this->conexion . '\\' => $this->dirEntidades));
$this->entityManager($confg);
}
示例12: initializeDoctrine
/**
* Initializes the doctrine framework and
* sets all required configuration options.
*
* @param none
* @return nothing
*/
public static function initializeDoctrine()
{
$config = new Configuration();
$driverImpl = $config->newDefaultAnnotationDriver(array(__DIR__));
$config->setMetadataDriverImpl($driverImpl);
$connectionOptions = PartKeepr::createConnectionOptionsFromConfig();
switch (strtolower(PartKeeprConfiguration::getOption("partkeepr.cache.implementation", "default"))) {
case "apc":
$cache = new \Doctrine\Common\Cache\ApcCache();
break;
case "xcache":
if (php_sapi_name() !== "cli") {
$cache = new \Doctrine\Common\Cache\XcacheCache();
} else {
// For CLI SAPIs, revert to the ArrayCache as Xcache spits out strange warnings when running in CLI.
$cache = new \Doctrine\Common\Cache\ArrayCache();
}
break;
case "memcache":
$memcache = new \Memcache();
$memcache->connect(PartKeeprConfiguration::getOption("partkeepr.cache.memcache.host", "localhost"), PartKeeprConfiguration::getOption("partkeepr.cache.memcache.port", "11211"));
$cache = new \Doctrine\Common\Cache\MemcacheCache();
$cache->setMemcache($memcache);
break;
case "default":
case "auto":
if (extension_loaded("xcache")) {
$cache = new \Doctrine\Common\Cache\XcacheCache();
} else {
if (extension_loaded("apc")) {
$cache = new \Doctrine\Common\Cache\ApcCache();
} else {
$cache = new \Doctrine\Common\Cache\ArrayCache();
}
}
break;
case "none":
$cache = new \Doctrine\Common\Cache\ArrayCache();
break;
}
$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);
$config->setProxyDir(self::getRootDirectory() . '/data/proxies');
$config->setProxyNamespace('Proxies');
$config->setEntityNamespaces(self::getEntityClasses());
$config->setAutoGenerateProxyClasses(false);
if (PartKeeprConfiguration::getOption("partkeepr.database.echo_sql_log", false) === true) {
$logger = new \Doctrine\DBAL\Logging\EchoSQLLogger();
$config->setSQLLogger($logger);
}
self::$entityManager = EntityManager::create($connectionOptions, $config);
}
示例13: setupMetadata
protected function setupMetadata(Configuration $config, $spec)
{
$driverImpl = $config->newDefaultAnnotationDriver($spec['metadata_paths'], $spec['simple_annotation']);
$config->setMetadataDriverImpl($driverImpl);
$config->setEntityNamespaces($spec['entity_namespaces']);
}
示例14: ClassLoader
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Configuration;
use Doctrine\Common\Cache\ArrayCache as Cache;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Doctrine\Common\ClassLoader;
$loader = new ClassLoader('Models', __DIR__ . '/src/Models');
$loader->register();
$loader = new ClassLoader('ModelsProxy', __DIR__ . '/src/Models');
$loader->register();
//Configuration
$config = new Configuration();
$cache = new Cache();
$config->setQueryCacheImpl($cache);
$config->setProxyDir(__DIR__ . '/src/Models');
$config->setProxyNamespace('ModelsProxy');
$config->setEntityNamespaces(array('Models'));
$config->setAutoGenerateProxyClasses(TRUE);
AnnotationRegistry::registerFile(__DIR__ . "/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php");
$driver = new Doctrine\ORM\Mapping\Driver\AnnotationDriver(new Doctrine\Common\Annotations\AnnotationReader(), array(__DIR__ . '/src/Models'));
$config->setMetadataDriverImpl($driver);
$config->setMetadataCacheImpl($cache);
$confgFile = __DIR__ . '/src/minichat3des.ini';
if (file_exists($confgFile)) {
$db = parse_ini_file($confgFile);
$connectionOptions = array('driver' => $db['driver'], 'host' => $db['host'], 'user' => $db['user'], 'password' => $db['password'], 'dbname' => $db['dbname']);
} else {
echo 'Arquivo .ini de configuração não encontrado!';
}
//getting EntityManager
$entityManager = EntityManager::create($connectionOptions, $config);