Skip to content

Conversation

rodion-k
Copy link

@rodion-k rodion-k commented Aug 8, 2021

No description provided.

@homersimpsons
Copy link
Collaborator

Hello @rodion-k sorry for the delay ... Can you provide more context about this change ?

  • Why is it required ?
  • How will it improve the developer experience ?

@rodion-k
Copy link
Author

rodion-k commented Dec 1, 2021

Hi @homersimpsons. The extrapolateParameters argument is needed because I want to pass parameter types to Doctrine DBAL, for example to use custom parameter types:

$query = new QueryResult(
    <<<SQL
        select *
        from call
        WHERE created_at BETWEEN :date_from AND :date_to
                AND assigned_to_uuid IN (:assigned_to_uuid)
    SQL,
    $this->connection,
    conditionsMode: SqlRenderInterface::CONDITION_GUESS,
    extrapolateParameters: false,
);
$query->setParameters($parameters, [
    'date_from' => DateFromCompanyType::NAME,
    'date_to' => DateToCompanyType::NAME,
    'assigned_to_uuid' => Connection::PARAM_STR_ARRAY,
]);

$items = $query->val();
$totalItems = (int)(new CountNbResult($query, $this->connection))->val();

Also, I added the conditionsMode argument, because QueryResult uses SqlRenderInterface::CONDITION_APPLY by default, but I want SqlRenderInterface::CONDITION_GUESS. For me, this is the main feature of this library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants