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


PHP ConfigManager::clear方法代码示例

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


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

示例1: runActivityLists

 /**
  * @param LoggerInterface $logger
  * @param bool            $dryRun
  */
 protected function runActivityLists(LoggerInterface $logger, $dryRun = false)
 {
     // @todo: this workaround should be removed in BAP-9156
     $this->configManager->clear();
     $targetEntities = $this->provider->getTargetEntityClasses(false);
     $toSchema = clone $this->schema;
     $hasSchemaChanges = false;
     foreach ($targetEntities as $targetEntity) {
         $associationName = ExtendHelper::buildAssociationName($targetEntity, ActivityListEntityConfigDumperExtension::ASSOCIATION_KIND);
         $relationTableName = $this->nameGenerator->generateManyToManyJoinTableName(ActivityListEntityConfigDumperExtension::ENTITY_CLASS, $associationName, $targetEntity);
         if (!$toSchema->hasTable($relationTableName)) {
             $hasSchemaChanges = true;
             $this->activityListExtension->addActivityListAssociation($toSchema, $this->metadataHelper->getTableNameByEntityClass($targetEntity));
         }
     }
     if ($hasSchemaChanges) {
         $comparator = new Comparator();
         $platform = $this->connection->getDatabasePlatform();
         $schemaDiff = $comparator->compare($this->schema, $toSchema);
         $queries = $schemaDiff->toSql($platform);
         foreach ($queries as $query) {
             $this->logQuery($logger, $query);
             if (!$dryRun) {
                 $this->connection->executeQuery($query);
             }
         }
     }
 }
开发者ID:woei66,项目名称:platform,代码行数:32,代码来源:ActivityListMigrationQuery.php

示例2: load

 /**
  * Load entity configs from annotations to a database
  *
  * @param bool                 $force  Force overwrite config's option values
  * @param callable|null        $filter function (ClassMetadata[] $doctrineAllMetadata)
  * @param LoggerInterface|null $logger
  * @param bool                 $dryRun Log modifications without apply them
  *
  * @throws \Exception
  */
 public function load($force = false, \Closure $filter = null, LoggerInterface $logger = null, $dryRun = false)
 {
     $this->logger = $logger ?: new NullLogger();
     try {
         $entityManagers = $this->entityManagerBag->getEntityManagers();
         foreach ($entityManagers as $em) {
             /** @var ClassMetadata[] $doctrineAllMetadata */
             $doctrineAllMetadata = $em->getMetadataFactory()->getAllMetadata();
             if (null !== $filter) {
                 $doctrineAllMetadata = $filter($doctrineAllMetadata);
             }
             foreach ($doctrineAllMetadata as $metadata) {
                 $this->loadEntityConfigs($metadata, $force);
             }
         }
         if ($dryRun) {
             $this->configManager->clear();
         } else {
             $this->configManager->flush();
             $this->configManager->flushAllCaches();
         }
     } catch (\Exception $ex) {
         $this->logger = null;
         throw $ex;
     }
 }
开发者ID:startupz,项目名称:platform-1,代码行数:36,代码来源:ConfigLoader.php

示例3: processConfigs

 /**
  * @param array                $configs
  * @param LoggerInterface|null $logger
  * @param bool                 $dryRun Log modifications without apply them
  * @throws \Exception
  */
 public function processConfigs(array $configs, LoggerInterface $logger = null, $dryRun = false)
 {
     $this->logger = $logger ?: new NullLogger();
     try {
         if (!empty($configs)) {
             $this->appendConfigs = $this->getAndRemoveElement($configs, self::APPEND_CONFIGS, []);
             $renameConfigs = $this->getAndRemoveElement($configs, self::RENAME_CONFIGS, []);
             $this->filterConfigs($configs);
             $hasChanges = false;
             if (!empty($configs)) {
                 foreach ($configs as $className => $entityConfigs) {
                     $this->processEntityConfigs($className, $entityConfigs);
                 }
                 $hasChanges = true;
             }
             if ($this->renameFields($renameConfigs)) {
                 $hasChanges = true;
             }
             if ($hasChanges) {
                 if ($dryRun) {
                     $this->configManager->clear();
                 } else {
                     $this->configManager->flush();
                     $this->configManager->clearCache();
                 }
             }
         }
     } catch (\Exception $ex) {
         $this->logger = null;
         throw $ex;
     }
 }
开发者ID:startupz,项目名称:platform-1,代码行数:38,代码来源:ExtendConfigProcessor.php


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