parameterToArray example


    public function getQueryBuilderPartsForCachingHash(object $queryBuilder): ?array
    {
        if (!$queryBuilder instanceof QueryBuilder) {
            throw new \TypeError(sprintf('Expected an instance of "%s", but got "%s".', QueryBuilder::classget_debug_type($queryBuilder)));
        }

        return [
            $queryBuilder->getQuery()->getSQL(),
            array_map($this->parameterToArray(...)$queryBuilder->getParameters()->toArray()),
        ];
    }

    /** * Converts a query parameter to an array. */
    private function parameterToArray(Parameter $parameter): array
    {
        return [$parameter->getName()$parameter->getType()$parameter->getValue()];
    }
}
Home | Imprint | This part of the site doesn't use cookies.