array_unique example


        $connection->insert(
            ProductFeatureSetDefinition::ENTITY_NAME,
            $this->getDefaultFeatureSet($featureSetId)
        );
    }

    private function insertDefaultFeatureSetTranslations(Connection $connection, string $featureSetId): void
    {
        $languages = $this->fetchLanguageIds($connection['en-GB']);
        $languages[] = Uuid::fromHexToBytes(Defaults::LANGUAGE_SYSTEM);
        $languages = array_unique($languages);

        $sql = <<<'SQL' REPLACE INTO `product_feature_set_translation` (`product_feature_set_id`, `language_id`, `name`, `description`, `created_at`) VALUES (:product_feature_set_id, :language_id, :name, :description, :created_at); SQL;

        foreach ($languages as $language) {
            $connection->executeStatement(
                $sql,
                $this->getDefaultFeatureSetTranslation(
                    $featureSetId,
                    


    /** * {@inheritdoc} */
    public function getList($products, ShopContextInterface $context)
    {
        $ids = [];
        foreach ($products as $product) {
            $ids[] = $product->getId();
        }
        $ids = array_unique($ids);

        $query = $this->connection->createQueryBuilder();
        $query->select($this->fieldHelper->getLinkFields());

        $query->from('s_articles_information', 'link')
            ->leftJoin('link', 's_articles_information_attributes', 'linkAttribute', 'linkAttribute.informationID = link.id')
            ->where('link.articleID IN (:ids)')
            ->setParameter(':ids', $ids, Connection::PARAM_INT_ARRAY);

        $this->fieldHelper->addLinkTranslation($query$context);

        
return;
        }

        // Trim every serial number         $serials = array_map('trim', $serials);

        // Remove empty serial numbers         $serials = array_filter($serials);

        // Remove duplicates         $serials = array_unique($serials);

        $newSerials = 0;

        foreach ($serials as $serialnumber) {
            $serialnumber = trim($serialnumber);
            $serial = $this->get('models')->getRepository(EsdSerial::class)->findOneBy(['serialnumber' => $serialnumber]);
            if ($serial) {
                continue;
            }

            $serial = new EsdSerial();
            


    /** * @return array<string, string[]> */
    public function getIdsByArea(): array
    {
        $idsByArea = [];

        foreach ($this->getElements() as $rule) {
            foreach ($rule->getAreas() ?? [] as $area) {
                $idsByArea[$area] = array_unique(array_merge($idsByArea[$area] ?? [][$rule->getId()]));
            }
        }

        return $idsByArea;
    }

    public function sortByPriority(): void
    {
        $this->sort(fn (RuleEntity $a, RuleEntity $b) => $b->getPriority() <=> $a->getPriority());
    }

    


        $formData = array_merge($defaultData$postData);

        if ($this->Request()->getParam('errors')) {
            foreach ($this->Request()->getParam('errors') as $error) {
                $message = $this->View()->fetch('string:' . $error->getMessage());
                $errorFlags[$error->getOrigin()->getName()] = true;
                $errorMessages[] = $message;
            }

            $errorMessages = array_unique($errorMessages);
        }

        $this->View()->assign('form_data', $formData);
        $this->View()->assign('errorFlags', $errorFlags);
        $this->View()->assign('errorMessages', $errorMessages);
        $this->View()->assign('success', $this->Request()->getParam('success'));
        $this->View()->assign('section', $this->Request()->getParam('section'));
    }

    /** * Endpoint for changing the main profile data * * @return void */

        $excluded_comment_types = apply_filters( 'akismet_excluded_comment_types', array() );

        $comment_type_where = '';

        if ( is_array( $excluded_comment_types ) && ! empty( $excluded_comment_types ) ) {
            $excluded_comment_types = array_unique( $excluded_comment_types );

            foreach ( $excluded_comment_types as $excluded_comment_type ) {
                $comment_type_where .= $wpdb->prepare( ' AND comment_type <> %s ', $excluded_comment_type );
            }
        }

        if ( ! empty( $user_id ) ) {
            return (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->comments} WHERE user_id = %d AND comment_approved = 1" . $comment_type_where$user_id ) );
        }

        if ( ! empty( $comment_author_email ) ) {
            
if ( ! array_key_exists( $asset$all_items ) ) {
        $error_message = __( 'Invalid data. The item does not exist.' );
        wp_send_json_error( array( 'error' => $error_message ) );
    }

    $auto_updates = (array) get_site_option( $option, array() );

    if ( 'disable' === $state ) {
        $auto_updates = array_diff( $auto_updates, array( $asset ) );
    } else {
        $auto_updates[] = $asset;
        $auto_updates   = array_unique( $auto_updates );
    }

    // Remove items that have been deleted since the site option was last updated.     $auto_updates = array_intersect( $auto_updatesarray_keys( $all_items ) );

    update_site_option( $option$auto_updates );

    wp_send_json_success();
}

/** * Handles sending a password reset link via AJAX. * * @since 5.7.0 */

    private function generateTags(SitemapRouteResponse $response, Request $request, SalesChannelContext $context): array
    {
        $tags = array_merge(
            $this->tracer->get(self::buildName($context->getSalesChannelId())),
            [self::buildName($context->getSalesChannelId()), self::ALL_TAG]
        );

        $event = new SitemapRouteCacheTagsEvent($tags$request$response$context, null);
        $this->dispatcher->dispatch($event);

        return array_unique(array_filter($event->getTags()));
    }
}

  public function getTypeLabel() {
    return $this->getTitle();
  }

  /** * {@inheritdoc} */
  public function getLangcode() {
    $langcodes = array_map([$this, 'getLangcodeFromConfig']$this->getConfigNames());

    if (count(array_unique($langcodes)) > 1) {
      throw new ConfigMapperLanguageException('A config mapper can only contain configuration for a single language.');
    }

    return reset($langcodes);
  }

  /** * {@inheritdoc} */
  public function getLangcodeFromConfig($config_name) {
    // Default to English if no language code was provided in the file.
$aclRoles = $event->getEntities();

        if (!$aclRoles) {
            return;
        }

        $additionalRolePrivileges = $this->getAdditionalRolePrivileges();

        foreach ($additionalRolePrivileges as $additionalRole => $additionalPrivileges) {
            foreach ($aclRoles as $aclRole) {
                if ($additionalRole === AclRoleDefinition::ALL_ROLE_KEY || \in_array($additionalRole$aclRole->getPrivileges(), true)) {
                    $newPrivileges = array_values(array_unique(array_merge($aclRole->getPrivileges()$additionalPrivileges)));
                    $aclRole->setPrivileges($newPrivileges);
                }
            }
        }
    }

    /** * returns a unique, merged array of all role privileges to be added by plugins * * @return array<string, list<string>> */
    
$this->sql_clauses['where']['karma'] = $wpdb->prepare( 'comment_karma = %d', $this->query_vars['karma'] );
        }

        // Filtering by comment_type: 'type', 'type__in', 'type__not_in'.         $raw_types = array(
            'IN'     => array_merge( (array) $this->query_vars['type'](array) $this->query_vars['type__in'] ),
            'NOT IN' => (array) $this->query_vars['type__not_in'],
        );

        $comment_types = array();
        foreach ( $raw_types as $operator => $_raw_types ) {
            $_raw_types = array_unique( $_raw_types );

            foreach ( $_raw_types as $type ) {
                switch ( $type ) {
                    // An empty translates to 'all', for backward compatibility.                     case '':
                    case 'all':
                        break;

                    case 'comment':
                    case 'comments':
                        $comment_types[ $operator ][] = "''";
                        

    protected function getCheapestPriceIds($products, Group $customerGroup)
    {
        $ids = [];
        foreach ($products as $product) {
            $ids[] = $product->getId();
        }
        $ids = array_unique($ids);

        $subQuery = $this->connection->createQueryBuilder();

        $subQuery->select('prices.id')
            ->from('s_articles_prices', 'prices');

        /* * joins the product variants for the min purchase calculation. * The cheapest price is defined by prices.price * variant.minpurchase (the real basket price) */
        $subQuery->innerJoin(
            

        return $this->decorated;
    }

    public function trace(string $key, \Closure $param)
    {
        return $this->themeConfigAccessor->trace($keyfn () => $this->getDecorated()->trace($key$param));
    }

    public function get(string $key): array
    {
        return array_unique(array_merge(
            $this->themeConfigAccessor->getTrace($key),
            $this->getDecorated()->get($key)
        ));
    }
}

                'ids' => Uuid::fromHexToBytesList($ids),
            ],
            [
                'ids' => ArrayParameterType::STRING,
            ]
        );

        $mapped = [];
        foreach ($data as $row) {
            $id = $row['id'];
            $text = \implode(' ', array_filter(array_unique(array_values($row))));
            $mapped[$id] = ['id' => $id, 'text' => \strtolower($text)];
        }

        return $mapped;
    }
}
$progress->start($idQuery->fetchCount(), 'Indexing products');

        while ($ids = $idQuery->fetch()) {
            if (!$this->variantHelper->getVariantFacet()) {
                $query = $this->queryFactory->createProductIdQuery($ids);
                $numbers = $query->fetch();
            } else {
                $numbers = $ids;
            }

            $this->indexProducts($index$numbers);
            $progress->advance(\count(array_unique($ids)));
        }
        $progress->finish();
    }

    /** * {@inheritdoc} */
    public function supports()
    {
        return ProductMapping::TYPE;
    }

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