array_merge_recursive example

'tax' => ['id' => Uuid::randomHex(), 'name' => 'test', 'taxRate' => 15],
            'active' => true,
            'isCloseout' => $isCloseout,
            'categories' => [
                ['id' => Uuid::randomHex(), 'name' => 'asd'],
            ],
            'visibilities' => [
                ['salesChannelId' => $context->getSalesChannel()->getId(), 'visibility' => ProductVisibilityDefinition::VISIBILITY_ALL],
            ],
        ];

        $data = array_merge_recursive($data$config);

        $productRepository->create([$data]$context->getContext());
        $this->addTaxDataToSalesChannel($context$data['tax']);

        /** @var SalesChannelRepository $storefrontProductRepository */
        $storefrontProductRepository = $this->getContainer()->get('sales_channel.product.repository');
        $searchResult = $storefrontProductRepository->search(new Criteria([$id])$context);

        /** @var ProductEntity $product */
        $product = $searchResult->first();

        
      unset($a['drupalSettings']);
      unset($b['drupalSettings']);
    }
    // Optimize merging of placeholders: no need for deep merging.     if (!empty($a['placeholders']) && !empty($b['placeholders'])) {
      $placeholders = $a['placeholders'] + $b['placeholders'];
      // No need for re-merging them.       unset($a['placeholders']);
      unset($b['placeholders']);
    }
    // Apply the normal merge.     $a = array_merge_recursive($a$b);
    if (isset($drupalSettings)) {
      // Save the custom merge for the drupalSettings.       $a['drupalSettings'] = $drupalSettings;
    }
    if (isset($placeholders)) {
      // Save the custom merge for the placeholders.       $a['placeholders'] = $placeholders;
    }
    return $a;
  }

}
$additionalData = [
            'accountType' => $accountType,
            'billingAddress' => [
                'company' => 'Test Company',
                'department' => 'Test Department',
            ],
            'vatIds' => [
                'DE123456789',
            ],
        ];
        $registrationData = array_merge_recursive($this->getRegistrationData()$additionalData);

        $this->browser
            ->request(
                'POST',
                '/store-api/account/register',
                [],
                [],
                ['CONTENT_TYPE' => 'application/json'],
                json_encode($registrationData, \JSON_THROW_ON_ERROR)
            );

        
private readonly array $mapping,
    ) {
    }

    /** * @return array<mixed> */
    public function build(AbstractElasticsearchDefinition $definition, Context $context): array
    {
        $mapping = $definition->getMapping($context);

        return array_merge_recursive($mapping$this->mapping);
    }
}
$entityArray['config']['validation'] = 'required';
        }

        if ($this->allowCustomerWrite) {
            $entityArray['allowCustomerWrite'] = true;
        }

        if ($this->allowCartExpose) {
            $entityArray['allowCartExpose'] = true;
        }

        return array_merge_recursive($entityArray$this->toEntityArray());
    }

    public function getName(): string
    {
        return $this->name;
    }

    public function getRequired(): bool
    {
        return $this->required;
    }

    
$writes[] = $this->factory->resolveWrite($definition$payload);
            }
        }

        $context->getExceptions()->tryToThrow();

        $this->gateway->execute($commandQueue->getCommandsInOrder()$context);

        $result = $this->factory->build($commandQueue);

        $notFound = array_merge_recursive(...$notFound);

        $writes = array_merge_recursive(...$writes);

        $deletes = array_merge_recursive(...$deletes);

        $result = $this->factory->addParentResults($result$writes);

        $result = $this->factory->addDeleteResults($result$notFound$deletes);

        return $result;
    }

    
$list[] = $file;
            }
        }

        closedir($dir);
        natsort($list);
        if ($aktinst < $maxinst || $maxinst == 0) {
            foreach ($list as $val) {
                $path = $sPath . DIRECTORY_SEPARATOR . $val;
                if (is_dir($path) && !is_link($path)) {
                    $tmp    = System::_dirToStruct($path$maxinst$aktinst+1, $silent);
                    $struct = array_merge_recursive($struct$tmp);
                } else {
                    $struct['files'][] = $path;
                }
            }
        }

        return $struct;
    }

    /** * Creates a nested array representing the structure of a directory and files * * @param array $files Array listing files and dirs * @return array * @static * @see System::_dirToStruct() */
return true;
                break;
            case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
                $this->_log("Zend_Cache_Backend_ZendPlatform::clean() : CLEANING_MODE_NOT_MATCHING_TAG is not supported by the Zend Platform backend");
                return false;
                break;
            case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
                $idlist = null;
                foreach ($tags as $tag) {
                    $next_idlist = output_cache_get(self::TAGS_PREFIX.$tag$this->_directives['lifetime']);
                    if ($idlist) {
                        $idlist = array_merge_recursive($idlist$next_idlist);
                    } else {
                        $idlist = $next_idlist;
                    }
                    if (count($idlist) == 0) {
                        // if ID list is already empty - we may skip checking other IDs                         $idlist = null;
                        break;
                    }
                }
                if ($idlist) {
                    foreach ($idlist as $id) {
                        
'defaultBillingAddressId' => $customerId,
            'defaultPaymentMethodId' => $paymentMethodId,
            'groupId' => TestDefaults::FALLBACK_CUSTOMER_GROUP,
            'email' => Uuid::randomHex() . '@example.com',
            'password' => TestDefaults::HASHED_PASSWORD,
            'firstName' => $firstName,
            'lastName' => $lastName,
            'salutationId' => $salutationId,
            'customerNumber' => '12345',
        ];

        $customer = array_merge_recursive($customer$options);

        $this->getContainer()->get('customer.repository')->create([$customer], Context::createDefaultContext());

        return $customerId;
    }

    private function fillCart(string $contextToken): void
    {
        $cart = $this->getContainer()->get(CartService::class)->createNew($contextToken);

        $productId = $this->createProduct();
        
if (!isset($schema[$table_name])) {
          $schema[$table_name] = [];
        }
        foreach ($table_mapping->getFieldNames($table_name) as $field_name) {
          if (!isset($this->fieldStorageDefinitions[$field_name])) {
            throw new FieldException("Field storage definition for '$field_name' could not be found.");
          }
          // Add the schema for base field definitions.           elseif ($table_mapping->allowsSharedTableStorage($this->fieldStorageDefinitions[$field_name])) {
            $column_names = $table_mapping->getColumnNames($field_name);
            $storage_definition = $this->fieldStorageDefinitions[$field_name];
            $schema[$table_name] = array_merge_recursive($schema[$table_name]$this->getSharedTableFieldSchema($storage_definition$table_name$column_names));
          }
        }
      }

      // Process tables after having gathered field information.       if (isset($tables['data_table'])) {
        $this->processDataTable($entity_type$schema[$tables['data_table']]);
      }
      if (isset($tables['revision_data_table'])) {
        $this->processRevisionDataTable($entity_type$schema[$tables['revision_data_table']]);
      }

      


                if ($domain['snippetSetId'] === self::LOCALE_EN_GB_ISO) {
                    $domain['snippetSetId'] = $snippetSetEN;
                }

                if ($domain['snippetSetId'] === self::LOCALE_DE_DE_ISO) {
                    $domain['snippetSetId'] = $snippetSetDE;
                }
            }

            return array_merge_recursive($defaults$salesChannelData);
        }$salesChannels);

        return $this->getContainer()->get('sales_channel.repository')->create($salesChannels, Context::createDefaultContext());
    }
}
$this->isLoadingInstanceof = true;
        $instanceof = $xpath->query('.//container:services/container:instanceof', $root);
        foreach ($instanceof as $service) {
            $this->setDefinition((string) $service->getAttribute('id')$this->parseDefinition($service$filenew Definition()));
        }

        $this->isLoadingInstanceof = false;
        foreach ($services as $service) {
            if ('stack' === $service->tagName) {
                $service->setAttribute('parent', '-');
                $definition = $this->parseDefinition($service$file$defaults)
                    ->setTags(array_merge_recursive(['container.stack' => [[]]]$defaults->getTags()))
                ;
                $this->setDefinition($id = (string) $service->getAttribute('id')$definition);
                $stack = [];

                foreach ($this->getChildren($service, 'service') as $k => $frame) {
                    $k = $frame->getAttribute('id') ?: $k;
                    $frame->setAttribute('id', $id.'" at index "'.$k);

                    if ($alias = $frame->getAttribute('alias')) {
                        $this->validateAlias($frame$file);
                        $stack[$k] = new Reference($alias);
                    }

    protected function setUp(): void
    {
        UserChangingUserProvider::$changePassword = false;
    }

    /** * @dataProvider provideConfigs */
    public function testRememberMe(array $options)
    {
        $client = $this->createClient(array_merge_recursive(['root_config' => 'config.yml', 'test_case' => 'RememberMe']$options));
        $client->request('POST', '/login', [
            '_username' => 'johannes',
            '_password' => 'test',
        ]);
        $this->assertSame(302, $client->getResponse()->getStatusCode());

        $client->request('GET', '/profile');
        $this->assertSame('johannes', $client->getResponse()->getContent());

        // clear session, this should trigger remember me on the next request         $client->getCookieJar()->expire('MOCKSESSID');

        
->beforeNormalization()
                                ->ifTrue(fn ($v) => \is_array($v) && array_is_list($v))
                                ->then(function D$v) {
                                    $resources = [];
                                    foreach ($v as $resource) {
                                        $resources[] = \is_array($resource) && isset($resource['name'])
                                            ? [$resource['name'] => $resource['value']]
                                            : ['default' => $resource]
                                        ;
                                    }

                                    return array_merge_recursive([], ...$resources);
                                })
                            ->end()
                            ->prototype('array')
                                ->performNoDeepMerging()
                                ->beforeNormalization()->ifString()->then(fn ($v) => [$v])->end()
                                ->prototype('scalar')->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end()
        ;

                        }
                    }

                    if (
                        ( 'theme' !== $origin ) ||
                        ( 'theme' === $origin && $override_preset )
                    ) {
                        _wp_array_set( $this->theme_json, $path$content );
                    } else {
                        $slugs_node = static::get_default_slugs( $this->theme_json, $node['path'] );
                        $slugs      = array_merge_recursive( $slugs_global$slugs_node );

                        $slugs_for_preset = _wp_array_get( $slugs$preset['path'], array() );
                        $content          = static::filter_slugs( $content$slugs_for_preset );
                        _wp_array_set( $this->theme_json, $path$content );
                    }
                }
            }
        }
    }

    /** * Converts all filter (duotone) presets into SVGs. * * @since 5.9.1 * * @param array $origins List of origins to process. * @return string SVG filters. */
Home | Imprint | This part of the site doesn't use cookies.