Skip to content

Commit

Permalink
Merge branch '2.18.x' into 2.19.x
Browse files Browse the repository at this point in the history
* 2.18.x:
  Fix Static Analysis folder reference (doctrine#11281)
  docs: recommend safer way to disable logging (doctrine#11269)
  Remove unused baseline entries
  Treat '0' as a legitimate trim char
  • Loading branch information
derrabus committed Feb 21, 2024
2 parents b59189a + 0efac09 commit c0dfba2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- src/**
- phpstan*
- psalm*
- tests/Doctrine/StaticAnalysis/**
- tests/StaticAnalysis/**
push:
branches:
- "*.x"
Expand All @@ -20,7 +20,7 @@ on:
- src/**
- phpstan*
- psalm*
- tests/Doctrine/StaticAnalysis/**
- tests/StaticAnalysis/**

jobs:
static-analysis-phpstan:
Expand Down
19 changes: 11 additions & 8 deletions docs/en/reference/batch-processing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,20 @@ especially what the strategies presented here provide help with.

.. note::

Having an SQL logger enabled when processing batches can have a serious impact on performance and resource usage.
To avoid that you should remove the corresponding middleware.
To remove all middlewares, you can use this line:
Having an SQL logger enabled when processing batches can have a
serious impact on performance and resource usage.
To avoid that, you should use a PSR logger implementation that can be
disabled at runtime.
For example, with Monolog, you can use ``Logger::pushHandler()``
to push a ``NullHandler`` to the logger instance, and then pop it
when you need to enable logging again.

With DBAL 2, you can disable the SQL logger like below:

.. code-block:: php
<?php
$em->getConnection()->getConfiguration()->setMiddlewares([]); // DBAL 3
$em->getConnection()->getConfiguration()->setSQLLogger(null); // DBAL 2
$em->getConnection()->getConfiguration()->setSQLLogger(null);
Bulk Inserts
------------
Expand Down Expand Up @@ -188,6 +194,3 @@ problems using the following approach:
Iterating results is not possible with queries that
fetch-join a collection-valued association. The nature of such SQL
result sets is not suitable for incremental hydration.



18 changes: 0 additions & 18 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1543,15 +1543,6 @@
</PossiblyInvalidPropertyAssignmentValue>
</file>
<file src="src/Query/AST/Functions/DateAddFunction.php">
<ArgumentTypeCoercion>
<code><![CDATA[$this->intervalExpression->dispatch($sqlWalker)]]></code>
<code><![CDATA[$this->intervalExpression->dispatch($sqlWalker)]]></code>
<code><![CDATA[$this->intervalExpression->dispatch($sqlWalker)]]></code>
<code><![CDATA[$this->intervalExpression->dispatch($sqlWalker)]]></code>
<code><![CDATA[$this->intervalExpression->dispatch($sqlWalker)]]></code>
<code><![CDATA[$this->intervalExpression->dispatch($sqlWalker)]]></code>
<code><![CDATA[$this->intervalExpression->dispatch($sqlWalker)]]></code>
</ArgumentTypeCoercion>
<PossiblyInvalidPropertyAssignmentValue>
<code><![CDATA[$parser->ArithmeticPrimary()]]></code>
<code><![CDATA[$parser->ArithmeticPrimary()]]></code>
Expand All @@ -1572,15 +1563,6 @@
</PossiblyInvalidPropertyAssignmentValue>
</file>
<file src="src/Query/AST/Functions/DateSubFunction.php">
<ArgumentTypeCoercion>
<code><![CDATA[$this->intervalExpression->dispatch($sqlWalker)]]></code>
<code><![CDATA[$this->intervalExpression->dispatch($sqlWalker)]]></code>
<code><![CDATA[$this->intervalExpression->dispatch($sqlWalker)]]></code>
<code><![CDATA[$this->intervalExpression->dispatch($sqlWalker)]]></code>
<code><![CDATA[$this->intervalExpression->dispatch($sqlWalker)]]></code>
<code><![CDATA[$this->intervalExpression->dispatch($sqlWalker)]]></code>
<code><![CDATA[$this->intervalExpression->dispatch($sqlWalker)]]></code>
</ArgumentTypeCoercion>
<UndefinedPropertyFetch>
<code><![CDATA[$this->unit->value]]></code>
</UndefinedPropertyFetch>
Expand Down
2 changes: 1 addition & 1 deletion src/Query/AST/Functions/TrimFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function parse(Parser $parser)
$this->trimChar = $lexer->token->value;
}

if ($this->leading || $this->trailing || $this->both || $this->trimChar) {
if ($this->leading || $this->trailing || $this->both || ($this->trimChar !== false)) {
$parser->match(TokenType::T_FROM);
}

Expand Down
5 changes: 5 additions & 0 deletions tests/Tests/ORM/Query/LanguageRecognitionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ public function testFunctionalExpressionsSupportedInWherePart(): void
$this->assertValidDQL("SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE TRIM(u.name) = 'someone'");
}

public function testTrimFalsyString(): void
{
$this->assertValidDQL("SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE TRIM('0' FROM u.name) = 'someone'");
}

public function testArithmeticExpressionsSupportedInWherePart(): void
{
$this->assertValidDQL('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE ((u.id + 5000) * u.id + 3) < 10000000');
Expand Down

0 comments on commit c0dfba2

Please sign in to comment.