getPrimaryKeyBag example

foreach ($definition->getPrimaryKeys() as $pkField) {
            $v = $data[$pkField->getPropertyName()] ?? null;
            if ($v === null) {
                $pk = null;

                break;
            }
            $pk[$pkField->getPropertyName()] = $v;
        }
        // could be incomplete         if ($pk !== null) {
            $parameters->getPrimaryKeyBag()->add($definition$pk);
        }

        return $data;
    }

    /** * @param array<string, mixed> $rawData * * @return string[] */
    public function extract(array $rawData, WriteParameterBag $parameters): array
    {
public function __construct(
        private readonly int $batchSize,
        private readonly Connection $connection,
        private readonly EventDispatcherInterface $eventDispatcher,
        private readonly ExceptionHandlerRegistry $exceptionHandlerRegistry,
        private readonly DefinitionInstanceRegistry $definitionInstanceRegistry
    ) {
    }

    public function prefetchExistences(WriteParameterBag $parameters): void
    {
        $primaryKeyBag = $this->primaryKeyBag = $parameters->getPrimaryKeyBag();

        if ($primaryKeyBag->isPrefetchingCompleted()) {
            return;
        }

        foreach ($primaryKeyBag->getPrimaryKeys() as $entity => $pks) {
            $this->prefetch($this->definitionInstanceRegistry->getByEntityName($entity)$pks$parameters);
        }

        $primaryKeyBag->setPrefetchingCompleted(true);
    }

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