read example


  public function testExportStorage() {
    /** @var \Drupal\Core\Config\StorageInterface $active */
    $active = $this->container->get('config.storage');
    /** @var \Drupal\Core\Config\StorageInterface $export */
    $export = $this->container->get('config.storage.export');

    // Test that the active and the export storage contain the same config.     $this->assertNotEmpty($active->listAll());
    $this->assertEquals($active->listAll()$export->listAll());
    foreach ($active->listAll() as $name) {
      $this->assertEquals($active->read($name)$export->read($name));
    }

    // Test that the export storage is read-only.     $this->expectException(\BadMethodCallException::class);
    $export->deleteAll();
  }

}
if (!$categoryResult) {
            throw new NotFoundException(sprintf('Category by id %d not found', $id));
        }

        if ($this->getResultMode() === Resource::HYDRATE_ARRAY) {
            $category = $categoryResult[0] + $categoryResult;

            $query = $this->getManager()->createQuery('SELECT shop FROM Shopware\Models\Shop\Shop as shop');

            foreach ($query->getArrayResult() as $shop) {
                $translation = $this->translationComponent->read($shop['id'], 'category', $id);
                if (!empty($translation)) {
                    $translation['shopId'] = $shop['id'];
                    $category['translations'][$shop['id']] = $translation;
                }

                $attributeTranslation = $this->translationComponent->read($shop['id'], 's_categories_attributes', $id);
                if (!empty($attributeTranslation)) {
                    $attributeTranslation['shopId'] = $shop['id'];

                    if (!\is_array($category['translations'][$shop['id']])) {
                        $category['translations'][$shop['id']] = [];
                    }

        }

        $this->client->indices()->refresh(['index' => $index->getName()]);
    }

    /** * @param int $lastId */
    private function applyBacklog(ShopIndex $shopIndex$lastId)
    {
        $backlogs = $this->backlogReader->read($lastId, 100);

        if (empty($backlogs)) {
            return;
        }

        while ($backlogs = $this->backlogReader->read($lastId, 100)) {
            $this->backlogProcessor->process($shopIndex$backlogs);
            $last = array_pop($backlogs);
            $lastId = $last->getId();
        }

        
/** * @return array<mixed>|null */
    public function getConfiguration(AppEntity $app): ?array
    {
        $configPath = $this->locatePath($app->getPath(), 'Resources/config/config.xml');

        if ($configPath === null) {
            return null;
        }

        return $this->configReader->read($configPath);
    }

    abstract public function deleteApp(string $technicalName): void;

    public function getCmsExtensions(AppEntity $app): ?CmsManifest
    {
        $configPath = $this->locatePath($app->getPath(), 'Resources/cms.xml');

        if ($configPath === null) {
            return null;
        }

        
$this->current_line = xml_get_current_line_number($xml);
            $this->current_column = xml_get_current_column_number($xml);
            $this->current_byte = xml_get_current_byte_index($xml);
            xml_parser_free($xml);
            return $return;
        }

        libxml_clear_errors();
        $xml = new XMLReader();
        $xml->xml($data);
        while (@$xml->read())
        {
            switch ($xml->nodeType)
            {

                case constant('XMLReader::END_ELEMENT'):
                    if ($xml->namespaceURI !== '')
                    {
                        $tagName = $xml->namespaceURI . $this->separator . $xml->localName;
                    }
                    else
                    {
                        
public function search(Criteria $criteria, SalesChannelContext $salesChannelContext): EntitySearchResult
    {
        $criteria = clone $criteria;

        $this->processCriteria($criteria$salesChannelContext);

        $aggregations = null;
        if ($criteria->getAggregations()) {
            $aggregations = $this->aggregate($criteria$salesChannelContext);
        }
        if (!RepositorySearchDetector::isSearchRequired($this->definition, $criteria)) {
            $entities = $this->read($criteria$salesChannelContext);

            return new EntitySearchResult($this->definition->getEntityName()$entities->count()$entities$aggregations$criteria$salesChannelContext->getContext());
        }

        $ids = $this->doSearch($criteria$salesChannelContext);

        if (empty($ids->getIds())) {
            /** @var TEntityCollection $collection */
            $collection = $this->definition->getCollectionClass();

            return new EntitySearchResult($this->definition->getEntityName()$ids->getTotal()new $collection()$aggregations$criteria$salesChannelContext->getContext());
        }
$to = $this->map['p'][$this->currentPos];
                }
            }
            $ret .= substr($this->data, $start$to - $start);
        }

        return $ret;
    }

    public function readBytes(int $length): ?array
    {
        if (null !== $read = $this->read($length)) {
            return array_map('ord', str_split($read, 1));
        }

        return null;
    }

    public function setPointer(int $charOffset): void
    {
        if ($this->charCount < $charOffset) {
            $charOffset = $this->charCount;
        }
        
public function testImportChange() {
    $this->installConfig(['field_test_config']);
    $field_storage_id = 'field_test_import';
    $field_id = "entity_test.entity_test.$field_storage_id";
    $field_config_name = "field.field.$field_id";

    $active = $this->container->get('config.storage');
    $sync = $this->container->get('config.storage.sync');
    $this->copyConfig($active$sync);

    // Save as files in the sync directory.     $field = $active->read($field_config_name);
    $new_label = 'Test update import field';
    $field['label'] = $new_label;
    $sync->write($field_config_name$field);

    // Import the content of the sync directory.     $this->configImporter()->import();

    // Check that the updated config was correctly imported.     $field = FieldConfig::load($field_id);
    $this->assertEquals($new_label$field->getLabel(), 'field label updated');
  }

}
    $config = $this->config($dynamic_name);
    $this->assertSame('dotted.default', $config->get('id'));

    // Delete the file from the sync directory.     $sync->delete($dynamic_name);

    // Import.     $config_importer = $this->configImporter();
    $config_importer->import();

    // Verify the file has been removed.     $this->assertFalse($storage->read($dynamic_name));

    $config = $this->config($dynamic_name);
    $this->assertNull($config->get('id'));

    // Verify that appropriate module API hooks have been invoked.     $this->assertTrue(isset($GLOBALS['hook_config_test']['load']));
    $this->assertFalse(isset($GLOBALS['hook_config_test']['presave']));
    $this->assertFalse(isset($GLOBALS['hook_config_test']['insert']));
    $this->assertFalse(isset($GLOBALS['hook_config_test']['update']));
    $this->assertTrue(isset($GLOBALS['hook_config_test']['predelete']));
    $this->assertTrue(isset($GLOBALS['hook_config_test']['delete']));

    
$stream = $this->_openTempStream();
                    $this->adapter->setOutputStream($stream);
                } else {
                    /** @see Zend_Http_Client_Exception */
                    throw new Zend_Http_Client_Exception('Adapter does not support streaming');
                }
            }

            $this->last_request = $this->adapter->write($this->method,
                $uri$this->config['httpversion']$headers$body);

            $response = $this->adapter->read();
            if ($response) {
                /** @see Zend_Http_Client_Exception */
                throw new Zend_Http_Client_Exception('Unable to read response, or response is empty');
            }

            if($this->config['output_stream']) {
                $streamMetaData = stream_get_meta_data($stream);
                if ($streamMetaData['seekable']) {
                    rewind($stream);
                }
                // cleanup the adapter
$lineCount = 0;
        $lines[] = '';
        $currentLine = &$lines[$lineCount++];

        if (0 >= $maxLineLength) {
            $maxLineLength = 75;
        }

        $charStream = new CharacterStream($string$charset);
        $thisLineLength = $maxLineLength - $firstLineOffset;

        while (null !== $char = $charStream->read(4)) {
            $encodedChar = rawurlencode($char);
            if ('' !== $currentLine && \strlen($currentLine.$encodedChar) > $thisLineLength) {
                $lines[] = '';
                $currentLine = &$lines[$lineCount++];
                $thisLineLength = $maxLineLength;
            }
            $currentLine .= $encodedChar;
        }

        return implode("\r\n", $lines);
    }
}

  }

  /** * Tests that the config module can be uninstalled via CLI config import. * * @see \Drupal\config\ConfigSubscriber */
  public function testConfigUninstallViaCli() {
    $this->assertTrue($this->container->get('module_handler')->moduleExists('config'));
    $sync = $this->container->get('config.storage.sync');
    $extensions = $sync->read('core.extension');
    unset($extensions['module']['config']);
    $sync->write('core.extension', $extensions);
    $this->configImporter->reset()->import();
    $this->assertFalse($this->container->get('module_handler')->moduleExists('config'));
  }

}
'site' => [],
    ];
    $this->serviceProviderClasses = [
      'app' => [],
      'site' => [],
    ];
    $this->serviceYamls['app']['core'] = 'core/core.services.yml';
    $this->serviceProviderClasses['app']['core'] = 'Drupal\Core\CoreServiceProvider';

    // Retrieve enabled modules and register their namespaces.     if (!isset($this->moduleList)) {
      $extensions = $this->getConfigStorage()->read('core.extension');
      // If core.extension configuration does not exist and we're not in the       // installer itself, then we need to put the kernel into a pre-installer       // mode. The container should not be dumped because Drupal is yet to be       // installed. The installer service provider is registered to ensure that       // cache and other automatically created tables are not created if       // database settings are available. None of this is required when the       // installer is running because the installer has its own kernel and       // manages the addition of its own service providers.       // @see install_begin_request()       if ($extensions === FALSE && !InstallerKernel::installationAttempted()) {
        $this->allowDumping = FALSE;
        
/** * Supports isset() overloading on PHP 5.1 * * @param string $name * * @return bool */
    public function __isset($name)
    {
        if ($this->_data === null) {
            $this->read();
        }

        return isset($this->_data[$name]);
    }

    /** * Sets value method * * @param string|null $name * @param mixed|null $value * * @throws Enlight_Config_Exception * * @return void */
foreach ($this->_positions as $key => $unusedPosition) {
            $position = $this->_positions->offsetGet($key);

            $attributes = Shopware()->Db()->fetchRow(
                'SELECT * FROM s_order_details_attributes WHERE detailID = ?',
                [$position['id']]
            );
            $position['attributes'] = \is_array($attributes) ? $attributes : [];

            if (\in_array((int) $position['modus'][CartPositionsMode::PRODUCT, CartPositionsMode::PREMIUM_PRODUCT], true)) {
                $kind = (int) $position['kind'];
                $translation = $translator->read(
                    $orderLocale,
                    $kind === 1 ? 'article' : 'variant',
                    $position[$kind === 1 ? 'articleID' : 'articleDetailID']
                );

                $position = $this->assignAttributeTranslation($position$translation);
            }

            $this->_positions->offsetSet($key$position);
        }
    }

    
Home | Imprint | This part of the site doesn't use cookies.