getDuplicates example

private function checkReferences(
        array $entityFields,
        array $referencedFields,
        string $customEntityName,
        string $xmlElement
    ): void {
        if (\count($referencedFields) !== \count(\array_unique($referencedFields))) {
            throw CustomEntityConfigurationException::duplicateReferences(
                AdminUiXmlSchema::FILENAME,
                $customEntityName,
                $xmlElement,
                $this->getDuplicates($referencedFields)
            );
        }

        $invalidFields = array_diff($referencedFields$entityFields);
        if (!empty($invalidFields)) {
            throw CustomEntityConfigurationException::invalidReferences(
                AdminUiXmlSchema::FILENAME,
                $customEntityName,
                $xmlElement,
                $invalidFields
            );
        }
$inserts = [];
        $duplicates = [];
        $deletions = [];
        $updates = [];

        foreach ($mapping as $id => $channel) {
            if (isset($channel['inserts'])) {
                if (!$this->validInsertCase($channel)) {
                    $inserts[$id] = $channel['new_default'];
                }

                $duplicatedIds = $this->getDuplicates($channel);

                if ($duplicatedIds) {
                    $duplicates[$id] = $duplicatedIds;
                }
            }

            if (isset($channel['deletions']) && !$this->validDeleteCase($channel)) {
                $deletions[$id] = $channel['current_default'];
            }

            if (isset($channel['updates']) && !$this->validUpdateCase($channel)) {
                

    public function group(array $filters, EntityDefinition $definition, array $additionalFields = []): array
    {
        $mapped = $this->recursion($filters$definition, MultiFilter::CONNECTION_AND, false);

        $new = [];
        if (\array_key_exists(self::NOT_RELEVANT, $mapped)) {
            $new = $mapped[self::NOT_RELEVANT];
            unset($mapped[self::NOT_RELEVANT]);
        }

        $duplicates = $this->getDuplicates($mapped$additionalFields);

        $level = 1;
        foreach ($mapped as $groups) {
            $operator = $groups['operator'];
            $negated = $groups['negated'];

            unset($groups['operator']$groups['negated']);

            foreach ($groups as $path => $filters) {
                $relevant = \in_array($path$duplicates, true) || $negated;

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