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


PHP ExtendHelper::getExtendEntityProxyClassName方法代码示例

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


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

示例1: updateEntity

 /**
  * @param EntityConfigEvent $event
  */
 public function updateEntity(EntityConfigEvent $event)
 {
     $className = $event->getClassName();
     $parentClassName = get_parent_class($className);
     if (!$parentClassName) {
         return;
     }
     if (ExtendHelper::isExtendEntityProxy($parentClassName)) {
         // When application is installed parent class will be replaced (via class_alias)
         $extendClass = $parentClassName;
     } else {
         // During install parent class is not replaced (via class_alias)
         $shortClassName = ExtendHelper::getShortClassName($className);
         if (ExtendHelper::getShortClassName($parentClassName) !== 'Extend' . $shortClassName) {
             return;
         }
         $extendClass = ExtendHelper::getExtendEntityProxyClassName($parentClassName);
     }
     $configManager = $event->getConfigManager();
     $config = $configManager->getProvider('extend')->getConfig($className);
     $hasChanges = false;
     if (!$config->is('is_extend')) {
         $config->set('is_extend', true);
         $hasChanges = true;
     }
     if (!$config->is('extend_class', $extendClass)) {
         $config->set('extend_class', $extendClass);
         $hasChanges = true;
     }
     if ($hasChanges) {
         $configManager->persist($config);
     }
 }
开发者ID:Maksold,项目名称:platform,代码行数:36,代码来源:EntityConfigListener.php

示例2: updateEntityConfig

 /**
  * @param EntityConfigEvent $event
  */
 public function updateEntityConfig(EntityConfigEvent $event)
 {
     $parentClassName = get_parent_class($event->getClassName());
     if (!$parentClassName) {
         return;
     }
     $shortClassName = ExtendHelper::getShortClassName($event->getClassName());
     if (ExtendHelper::getShortClassName($parentClassName) !== 'Extend' . $shortClassName) {
         return;
     }
     $config = $event->getConfigManager()->getProvider('extend')->getConfig($event->getClassName());
     $hasChanges = false;
     if (!$config->is('is_extend')) {
         $config->set('is_extend', true);
         $hasChanges = true;
     }
     $extendClass = ExtendHelper::getExtendEntityProxyClassName($parentClassName);
     if (!$config->is('extend_class', $extendClass)) {
         $config->set('extend_class', $extendClass);
         $hasChanges = true;
     }
     if ($hasChanges) {
         $event->getConfigManager()->persist($config);
     }
 }
开发者ID:xamin123,项目名称:platform,代码行数:28,代码来源:ConfigSubscriber.php

示例3: doExecute

 /**
  * @param LoggerInterface $logger
  * @param bool            $dryRun
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 protected function doExecute(LoggerInterface $logger, $dryRun = false)
 {
     $configs = $this->loadConfigs($logger);
     foreach ($configs as $id => $item) {
         $data = $item['data'];
         if (!isset($data['extend']['is_extend']) || !$data['extend']['is_extend']) {
             continue;
         }
         if (empty($data['extend']['extend_class']) || empty($data['extend']['schema']['parent'])) {
             continue;
         }
         $className = $item['class_name'];
         if (ExtendHelper::isCustomEntity($className)) {
             continue;
         }
         $parentClass = $data['extend']['schema']['parent'];
         $oldExtendClass = $data['extend']['extend_class'];
         $newExtendClass = ExtendHelper::getExtendEntityProxyClassName($parentClass);
         if (!$newExtendClass || $newExtendClass === $oldExtendClass) {
             continue;
         }
         $data['extend']['extend_class'] = $newExtendClass;
         if (isset($data['extend']['schema']['entity'])) {
             $data['extend']['schema']['entity'] = $newExtendClass;
         }
         if (isset($data['extend']['schema']['doctrine'][$oldExtendClass])) {
             $data['extend']['schema']['doctrine'][$newExtendClass] = $data['extend']['schema']['doctrine'][$oldExtendClass];
             unset($data['extend']['schema']['doctrine'][$oldExtendClass]);
         }
         $query = 'UPDATE oro_entity_config SET data = :data WHERE id = :id';
         $params = ['data' => $data, 'id' => $id];
         $types = ['data' => 'array', 'id' => 'integer'];
         $logger->notice(sprintf('Change extend class from "%s" to "%s" for "%s".', $oldExtendClass, $newExtendClass, $className));
         $this->logQuery($logger, $query, $params, $types);
         if (!$dryRun) {
             $this->connection->executeUpdate($query, $params, $types);
         }
     }
 }
开发者ID:Maksold,项目名称:platform,代码行数:45,代码来源:ChangeExtendClassNameQuery.php

示例4: testGetExtendEntityProxyClassName

 /**
  * @dataProvider getExtendEntityProxyClassNameProvider
  */
 public function testGetExtendEntityProxyClassName($className, $expected)
 {
     $this->assertEquals($expected, ExtendHelper::getExtendEntityProxyClassName($className));
 }
开发者ID:snorchel,项目名称:platform,代码行数:7,代码来源:ExtendHelperTest.php


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