コード例 #1
0
 /**
  * @param LoggerInterface $logger
  */
 protected function loadEntityConfigStates(LoggerInterface $logger)
 {
     if (!$this->connection->getSchemaManager()->tablesExist(['oro_entity_config', 'oro_entity_config_field'])) {
         return;
     }
     $entityConfigs = [];
     $sql = 'SELECT e.class_name, e.data FROM oro_entity_config e';
     $this->logQuery($logger, $sql);
     foreach ($this->connection->fetchAll($sql) as $row) {
         $data = $this->connection->convertToPHPValue($row['data'], 'array');
         if (isset($data['extend']['state']) && $data['extend']['state'] !== ExtendScope::STATE_ACTIVE) {
             $entityConfigs[$row['class_name']] = $data['extend']['state'];
         }
     }
     $fieldConfigs = [];
     $sql = 'SELECT e.class_name, f.field_name, f.data ' . 'FROM oro_entity_config e ' . 'INNER JOIN oro_entity_config_field f ON f.entity_id = e.id';
     $this->logQuery($logger, $sql);
     foreach ($this->connection->fetchAll($sql) as $row) {
         $data = $this->connection->convertToPHPValue($row['data'], 'array');
         if (isset($data['extend']['state']) && $data['extend']['state'] !== ExtendScope::STATE_ACTIVE) {
             $fieldConfigs[$row['class_name']][$row['field_name']] = $data['extend']['state'];
         }
     }
     $this->storage->set('initial_entity_config_state', ['entities' => $entityConfigs, 'fields' => $fieldConfigs]);
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function execute(LoggerInterface $logger)
 {
     $optionSets = $this->loadOptionSets($logger);
     $optionSetValues = $this->loadOptionSetValues($logger);
     $assignments = $this->loadOptionSetAssignments($logger);
     foreach ($optionSets as &$optionSet) {
         $fieldId = $optionSet['field_id'];
         $values = isset($optionSetValues[$fieldId]) ? $optionSetValues[$fieldId] : [];
         foreach ($values as &$value) {
             $optionId = $value['option_id'];
             if (isset($assignments[$fieldId][$optionId])) {
                 $value['assignments'][] = $assignments[$fieldId][$optionId];
             }
         }
         $optionSet['values'] = $values;
         $optionSet['data'] = $this->connection->convertToPHPValue($optionSet['data'], 'array');
     }
     $this->storage->set('existing_option_sets', $optionSets);
 }