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


PHP EntityManager::getConfiguration方法代码示例

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


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

示例1: getSystemInformation

 /**
  * Returns a list of system information records.
  *
  * Please note that it is not defined which information is returned; the result
  * should be seen as "informational" to the system operator, not for automated purposes.
  *
  * @return SystemInformationRecord[] An array of SystemInformationRecords
  */
 public function getSystemInformation()
 {
     $aData = [];
     $aData[] = new SystemInformationRecord('Doctrine ORM', ORMVersion::VERSION, 'Libraries');
     $aData[] = new SystemInformationRecord('Doctrine DBAL', DBALVersion::VERSION, 'Libraries');
     $aData[] = new SystemInformationRecord('PHP Version', phpversion(), 'System');
     $os = new OperatingSystem();
     $aData[] = new SystemInformationRecord('Operating System Type', $os->getPlatform(), 'System');
     $aData[] = new SystemInformationRecord('Operating System Release', $os->getRelease(), 'System');
     $aData[] = new SystemInformationRecord('memory_limit', ini_get('memory_limit'), 'PHP');
     $aData[] = new SystemInformationRecord('post_max_size', ini_get('post_max_size'), 'PHP');
     $aData[] = new SystemInformationRecord('upload_max_filesize', ini_get('upload_max_filesize'), 'PHP');
     $aData[] = new SystemInformationRecord('allow_url_fopen', ini_get('allow_url_fopen'), 'PHP');
     $aData[] = new SystemInformationRecord('max_execution_time', ini_get('max_execution_time'), 'PHP');
     $queryCache = get_class($this->entityManager->getConfiguration()->getQueryCacheImpl());
     $metadataCache = get_class($this->entityManager->getConfiguration()->getMetadataCacheImpl());
     $aData[] = new SystemInformationRecord('Query Cache Implementation', $queryCache, 'PHP');
     $aData[] = new SystemInformationRecord('Metadata Cache Implementation', $metadataCache, 'PHP');
     $aData[] = new SystemInformationRecord('Disk Space (Total)', $this->format_bytes($this->getTotalDiskSpace()), 'PartKeepr');
     $aData[] = new SystemInformationRecord('Disk Space (Free)', $this->format_bytes($this->getFreeDiskSpace()), 'PartKeepr');
     $aData[] = new SystemInformationRecord('Disk Space (Used)', $this->format_bytes($this->getUsedDiskSpace()), 'PartKeepr');
     $aData[] = new SystemInformationRecord('Data Directory', realpath($this->container->getParameter('partkeepr.filesystem.data_directory')), 'PartKeepr');
     $aData[] = new SystemInformationRecord('PartKeepr Version', $this->versionService->getCanonicalVersion(), 'PartKeepr');
     return $aData;
 }
开发者ID:partkeepr,项目名称:PartKeepr,代码行数:33,代码来源:SystemService.php

示例2: getSystemInformation

 /**
  * Returns a list of system information records.
  *
  * Please note that it is not defined which information is returned; the result
  * should be seen as "informational" to the system operator, not for automated purposes.
  *
  * @return SystemInformationRecord[] An array of SystemInformationRecords
  */
 public function getSystemInformation()
 {
     $aData = array();
     $aData[] = new SystemInformationRecord("Doctrine ORM", ORMVersion::VERSION, "Libraries");
     $aData[] = new SystemInformationRecord("Doctrine DBAL", DBALVersion::VERSION, "Libraries");
     $aData[] = new SystemInformationRecord("PHP Version", phpversion(), "System");
     $os = new OperatingSystem();
     $aData[] = new SystemInformationRecord("Operating System Type", $os->getPlatform(), "System");
     $aData[] = new SystemInformationRecord("Operating System Release", $os->getRelease(), "System");
     $aData[] = new SystemInformationRecord("memory_limit", ini_get("memory_limit"), "PHP");
     $aData[] = new SystemInformationRecord("post_max_size", ini_get("post_max_size"), "PHP");
     $aData[] = new SystemInformationRecord("upload_max_filesize", ini_get("upload_max_filesize"), "PHP");
     $aData[] = new SystemInformationRecord("allow_url_fopen", ini_get("allow_url_fopen"), "PHP");
     $aData[] = new SystemInformationRecord("max_execution_time", ini_get("max_execution_time"), "PHP");
     $queryCache = get_class($this->entityManager->getConfiguration()->getQueryCacheImpl());
     $metadataCache = get_class($this->entityManager->getConfiguration()->getMetadataCacheImpl());
     $aData[] = new SystemInformationRecord("Query Cache Implementation", $queryCache, "PHP");
     $aData[] = new SystemInformationRecord("Metadata Cache Implementation", $metadataCache, "PHP");
     $aData[] = new SystemInformationRecord("Disk Space (Total)", $this->format_bytes($this->getTotalDiskSpace()), "PartKeepr");
     $aData[] = new SystemInformationRecord("Disk Space (Free)", $this->format_bytes($this->getFreeDiskSpace()), "PartKeepr");
     $aData[] = new SystemInformationRecord("Disk Space (Used)", $this->format_bytes($this->getUsedDiskSpace()), "PartKeepr");
     $aData[] = new SystemInformationRecord("Data Directory", realpath($this->container->getParameter("partkeepr.filesystem.data_directory")), "PartKeepr");
     $aData[] = new SystemInformationRecord("PartKeepr Version", $this->versionService->getVersion(), "PartKeepr");
     return $aData;
 }
开发者ID:fulcrum3d,项目名称:PartKeepr,代码行数:33,代码来源:SystemService.php

示例3: getReaderFromEntityManager

 /**
  * @return AnnotationReader
  */
 protected function getReaderFromEntityManager()
 {
     $configuration = $this->entityManager->getConfiguration();
     /** @var AnnotationDriver $driver */
     $driver = $configuration->getMetadataDriverImpl();
     return $driver->getReader();
 }
开发者ID:pmill,项目名称:doctrine-rest-api,代码行数:10,代码来源:Doctrine.php

示例4: __construct

 public function __construct($setConfigFiles = true)
 {
     if ($setConfigFiles) {
         $this->configFile = __DIR__ . '/../../../config.php';
         $this->localConfigFile = __DIR__ . '/../../../config.local.php';
     }
     parent::__construct();
     $isDevMode = false;
     $cache = new \Doctrine\Common\Cache\FilesystemCache(__DIR__ . '/../../tmp');
     $config = Setup::createConfiguration($isDevMode, __DIR__ . '/../../tmp', $cache);
     $config->setProxyDir(__DIR__ . '/../../tmp');
     $config->setProxyNamespace('MyProject\\Proxies');
     $config->setAutoGenerateProxyClasses(true);
     $paths = [__DIR__ . '/../Entity'];
     $driver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver(new AnnotationReader(), $paths);
     \Doctrine\Common\Annotations\AnnotationRegistry::registerLoader('class_exists');
     $config->setMetadataDriverImpl($driver);
     //$config->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());
     $conn = ['driver' => 'mysqli', 'host' => '127.0.0.1', 'user' => $this->databaseFactory->getUserName(), 'password' => $this->databaseFactory->getPassword(), 'dbname' => $this->databaseFactory->getDatabaseName()];
     $this->entityManager = EntityManager::create($conn, $config);
     $this->entityManager->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
     \Doctrine\DBAL\Types\Type::addType('enum', StringType::class);
     $this->entityManager->getConfiguration()->addCustomStringFunction('DATE', DateFunction::class);
     $this->user = $this->entityManager->createQueryBuilder()->select('u')->from(Sources\Tests\Entity\User::class, 'u');
 }
开发者ID:mesour,项目名称:filter,代码行数:25,代码来源:BaseDoctrineFilterSourceTest.php

示例5: generateEntityManagerProxies

 /**
  * Generate doctrine proxy classes for extended entities for the given entity manager
  *
  * @param EntityManager $em
  */
 protected function generateEntityManagerProxies(EntityManager $em)
 {
     $isAutoGenerated = $em->getConfiguration()->getAutoGenerateProxyClasses();
     if (!$isAutoGenerated) {
         $proxyDir = $em->getConfiguration()->getProxyDir();
         if (!empty($this->cacheDir) && $this->kernelCacheDir !== $this->cacheDir && strpos($proxyDir, $this->kernelCacheDir) === 0) {
             $proxyDir = $this->cacheDir . substr($proxyDir, strlen($this->kernelCacheDir));
         }
         $metadataFactory = $em->getMetadataFactory();
         $proxyFactory = $em->getProxyFactory();
         $extendConfigs = $this->extendConfigProvider->getConfigs(null, true);
         foreach ($extendConfigs as $extendConfig) {
             if (!$extendConfig->is('is_extend')) {
                 continue;
             }
             if ($extendConfig->in('state', [ExtendScope::STATE_NEW])) {
                 continue;
             }
             $entityClass = $extendConfig->getId()->getClassName();
             $proxyFileName = $proxyDir . DIRECTORY_SEPARATOR . '__CG__' . str_replace('\\', '', $entityClass) . '.php';
             $metadata = $metadataFactory->getMetadataFor($entityClass);
             $proxyFactory->generateProxyClasses([$metadata], $proxyDir);
             clearstatcache(true, $proxyFileName);
         }
     }
 }
开发者ID:Maksold,项目名称:platform,代码行数:31,代码来源:EntityProxyGenerator.php

示例6: __construct

 /**
  * @param EntityManager $em
  * @throws LogicException
  */
 public function __construct(EntityManager $em)
 {
     $this->em = $em;
     $this->doctrine = $this->em->getConfiguration()->getMetadataDriverImpl();
     if (!$this->doctrine instanceof AnnotationDriver) {
         throw new LogicException('Doxport expects Doctrine2 to be using an annotation metadata driver');
     }
 }
开发者ID:vend,项目名称:doxport,代码行数:12,代码来源:Driver.php

示例7: setupDoctrine

 /**
  * @throws \Doctrine\ORM\ORMException
  */
 protected function setupDoctrine()
 {
     $databaseConfig = ['driver' => 'pdo_sqlite', 'dbname' => ':memory:'];
     $doctrineConfig = \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration(['tests/fixtures/'], false, getcwd() . '/build/tmp', new ArrayCache(), false);
     $doctrineConfig->setAutoGenerateProxyClasses(true);
     $this->entityManager = EntityManager::create($databaseConfig, $doctrineConfig);
     $this->annotationReader = $this->entityManager->getConfiguration()->getMetadataDriverImpl();
 }
开发者ID:pmill,项目名称:doctrine-array-hydrator,代码行数:11,代码来源:TestCase.php

示例8: denormalize

 /**
  * {@inheritdoc}
  */
 public function denormalize($data, $type, $format = null)
 {
     // Use alias namespace ?
     if (strrpos($type, ':') !== false) {
         list($namespaceAlias, $simpleClassName) = explode(':', $type);
         $type = $this->entityManager->getConfiguration()->getEntityNamespace($namespaceAlias) . '\\' . $simpleClassName;
     }
     return parent::denormalize($data, $type, $format);
 }
开发者ID:nervo,项目名称:DoctrineEntitySerializer,代码行数:12,代码来源:DoctrineEntitySerializer.php

示例9: setUp

 /**
  * Bootstrap
  */
 public function setUp()
 {
     parent::setUp();
     $reader = new AnnotationReader();
     $metadataDriver = new AnnotationDriver($reader, User::class);
     $this->em = $this->_getTestEntityManager();
     $this->em->getConfiguration()->setMetadataDriverImpl($metadataDriver);
     $this->obj = $this->em->getRepository(User::class);
 }
开发者ID:mrprompt,项目名称:silex-api-skel,代码行数:12,代码来源:UserTest.php

示例10: __construct

 /**
  * @param \Doctrine\ORM\EntityManager $entityManager
  */
 public function __construct(\Doctrine\ORM\EntityManager $entityManager)
 {
     $this->entityManager = $entityManager;
     $config = $this->entityManager->getConfiguration();
     $config->addCustomDatetimeFunction('DATE_FORMAT', "\\ModelModule\\Doctrine\\Functions\\DateFormat");
     $config->addCustomDatetimeFunction('MONTH', "\\ModelModule\\Doctrine\\Functions\\Month");
     $config->addCustomDatetimeFunction('MD5', "\\ModelModule\\Doctrine\\Functions\\Md5");
     $this->queryBuilder = $this->entityManager->createQueryBuilder();
 }
开发者ID:usban,项目名称:entilocali,代码行数:12,代码来源:QueryBuilderHelperAbstract.php

示例11: execute

 protected final function execute(InputInterface $input, OutputInterface $output)
 {
     $this->output = $output;
     $logger = new \CarFramework\ConsoleSQLLogger($output);
     $this->em->getConfiguration()->setSQLLogger($logger);
     $args = $input->getArgument("args");
     $this->play($this->em, $args);
     $logger->finalize();
 }
开发者ID:eniuz,项目名称:doctrine-example-app,代码行数:9,代码来源:ConsoleScenario.php

示例12: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->enableSecondLevelCache();
     $this->em = $this->_getTestEntityManager();
     $this->region = new CacheRegionMock();
     $this->queryCache = new DefaultQueryCache($this->em, $this->region);
     $this->cacheFactory = new CacheFactoryDefaultQueryCacheTest($this->queryCache, $this->region);
     $this->em->getConfiguration()->getSecondLevelCacheConfiguration()->setCacheFactory($this->cacheFactory);
 }
开发者ID:selimcr,项目名称:servigases,代码行数:10,代码来源:DefaultQueryCacheTest.php

示例13: getEntityManager

 /**
  * Because the EntityManager gets closed when there's an error, it needs to
  * be created again
  *
  * @return EntityManager
  * @throws ORMException
  */
 protected function getEntityManager()
 {
     if (!$this->em) {
         $this->em = $this->getContainer()->get('doctrine.orm.entity_manager');
     }
     if (!$this->em->isOpen()) {
         $this->em = $this->em->create($this->em->getConnection(), $this->em->getConfiguration());
     }
     return $this->em;
 }
开发者ID:evertharmeling,项目名称:brouwkuyp-control,代码行数:17,代码来源:BaseCommand.php

示例14: getUpdateQueries

 /**
  * @return string[]
  */
 protected function getUpdateQueries()
 {
     $cache = $this->entityManager->getConfiguration()->getMetadataCacheImpl();
     if ($cache instanceof ClearableCache) {
         $cache->deleteAll();
     }
     $schemaTool = new SchemaTool($this->entityManager);
     $metadata = $this->entityManager->getMetadataFactory()->getAllMetadata();
     $queries = $schemaTool->getUpdateSchemaSql($metadata, TRUE);
     return $queries;
 }
开发者ID:nextras,项目名称:migrations,代码行数:14,代码来源:StructureDiffGenerator.php

示例15: setUp

 protected function setUp()
 {
     $this->em = $this->getTestEntityManager();
     $config = $this->em->getConfiguration();
     $metadataDriver = new AnnotationDriver(new AnnotationReader(), 'OroCRM\\Bundle\\ChannelBundle\\Tests\\Unit\\Stubs\\Entity');
     $config->setMetadataDriverImpl($metadataDriver);
     $config->setEntityNamespaces(['OroCRMChannelBundle' => 'OroCRM\\Bundle\\ChannelBundle\\Tests\\Unit\\Stubs\\Entity']);
     $registry = $this->getMock('Doctrine\\Common\\Persistence\\ManagerRegistry');
     $registry->expects($this->any())->method('getManager')->will($this->returnValue($this->em));
     $this->helper = new ChannelHelper($registry);
 }
开发者ID:dairdr,项目名称:crm,代码行数:11,代码来源:ChannelHelperTest.php


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