當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。