Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ on:

jobs:
coding-standards:
uses: "doctrine/.github/.github/workflows/coding-standards.yml@12.1.0"
uses: "doctrine/.github/.github/workflows/coding-standards.yml@v12.2.0"
20 changes: 20 additions & 0 deletions .github/workflows/composer-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Composer Lint"

on:
pull_request:
branches:
- "*.x"
paths:
- ".github/workflows/composer-lint.yml"
- "composer.json"
push:
branches:
- "*.x"
paths:
- ".github/workflows/composer-lint.yml"
- "composer.json"

jobs:
composer-lint:
name: "Composer Lint"
uses: "doctrine/.github/.github/workflows/[email protected]"
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ on:
jobs:
documentation:
name: "Documentation"
uses: "doctrine/.github/.github/workflows/documentation.yml@12.1.0"
uses: "doctrine/.github/.github/workflows/documentation.yml@v12.2.0"
2 changes: 1 addition & 1 deletion .github/workflows/release-on-milestone-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
release:
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@12.1.0"
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@v12.2.0"
secrets:
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
Expand Down
73 changes: 46 additions & 27 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,39 @@
{
"name": "doctrine/orm",
"type": "library",
"description": "Object-Relational-Mapper for PHP",
"keywords": ["orm", "database"],
"homepage": "https://www.doctrine-project.org/projects/orm.html",
"license": "MIT",
"authors": [
{"name": "Guilherme Blanco", "email": "[email protected]"},
{"name": "Roman Borschel", "email": "[email protected]"},
{"name": "Benjamin Eberlei", "email": "[email protected]"},
{"name": "Jonathan Wage", "email": "[email protected]"},
{"name": "Marco Pivetta", "email": "[email protected]"}
"type": "library",
"keywords": [
"orm",
"database"
],
"scripts": {
"docs": "composer --working-dir docs update && ./docs/vendor/bin/build-docs.sh @additional_args"
},
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
"authors": [
{
"name": "Guilherme Blanco",
"email": "[email protected]"
},
"sort-packages": true
},
{
"name": "Roman Borschel",
"email": "[email protected]"
},
{
"name": "Benjamin Eberlei",
"email": "[email protected]"
},
{
"name": "Jonathan Wage",
"email": "[email protected]"
},
{
"name": "Marco Pivetta",
"email": "[email protected]"
}
],
"homepage": "https://www.doctrine-project.org/projects/orm.html",
"require": {
"php": "^7.1 || ^8.0",
"composer-runtime-api": "^2",
"ext-ctype": "*",
"composer-runtime-api": "^2",
"doctrine/cache": "^1.12.1 || ^2.1.1",
"doctrine/collections": "^1.5 || ^2.1",
"doctrine/common": "^3.0.3",
Expand All @@ -47,7 +54,7 @@
"doctrine/coding-standard": "^9.0.2 || ^14.0",
"phpbench/phpbench": "^0.16.10 || ^1.0",
"phpstan/extension-installer": "~1.1.0 || ^1.4",
"phpstan/phpstan": "~1.4.10 || 2.1.22",
"phpstan/phpstan": "~1.4.10 || 2.1.23",
"phpstan/phpstan-deprecation-rules": "^1 || ^2",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.6",
"psr/log": "^1 || ^2 || ^3",
Expand All @@ -64,17 +71,29 @@
"symfony/yaml": "If you want to use YAML Metadata Mapping Driver"
},
"autoload": {
"psr-4": { "Doctrine\\ORM\\": "src" }
"psr-4": {
"Doctrine\\ORM\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Doctrine\\Tests\\": "tests/Tests",
"Doctrine\\Performance\\": "tests/Performance",
"Doctrine\\StaticAnalysis\\": "tests/StaticAnalysis",
"Doctrine\\Performance\\": "tests/Performance"
"Doctrine\\Tests\\": "tests/Tests"
}
},
"bin": ["bin/doctrine"],
"archive": {
"exclude": ["!vendor", "tests", "*phpunit.xml", "build.xml", "build.properties", "composer.phar", "vendor/satooshi", "lib/vendor", "*.swp"]
"bin": [
"bin/doctrine"
],
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
},
"sort-packages": true
},
"scripts": {
"docs": "composer --working-dir docs update && ./docs/vendor/bin/build-docs.sh @additional_args"
}
}
1 change: 0 additions & 1 deletion docs/en/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ If this documentation is not helping to answer questions you have about
Doctrine ORM don't panic. You can get help from different sources:

- There is a :doc:`FAQ <reference/faq>` with answers to frequent questions.
- The `Doctrine Mailing List <https://groups.google.com/group/doctrine-user>`_
- Slack chat room `#orm <https://www.doctrine-project.org/slack>`_
- Report a bug on `GitHub <https://github.com/doctrine/orm/issues>`_.
- On `StackOverflow <https://stackoverflow.com/questions/tagged/doctrine-orm>`_
Expand Down
32 changes: 7 additions & 25 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,12 @@ parameters:
count: 1
path: src/Internal/HydrationCompleteHandler.php

-
message: '#^Offset int\|null might not exist on array\<int, object\>\.$#'
identifier: offsetAccess.notFound
count: 1
path: src/Internal/StronglyConnectedComponents.php

-
message: '#^Property Doctrine\\ORM\\Internal\\StronglyConnectedComponents\:\:\$representingNodes \(array\<int, object\>\) does not accept array\<int\|string, object\>\.$#'
identifier: assign.propertyType
Expand Down Expand Up @@ -3594,7 +3600,7 @@ parameters:
-
message: '#^Property Doctrine\\ORM\\Query\\Filter\\SQLFilter\:\:\$parameters \(array\<string, array\{type\: string, value\: mixed, is_list\: bool\}\>\) does not accept non\-empty\-array\<string, array\{value\: mixed, type\: int\|string, is_list\: bool\}\>\.$#'
identifier: assign.propertyType
count: 1
count: 2
path: src/Query/Filter/SQLFilter.php

-
Expand Down Expand Up @@ -4173,12 +4179,6 @@ parameters:
count: 1
path: src/Tools/Console/Command/ConvertMappingCommand.php

-
message: '#^Parameter \#2 \$destPath of method Doctrine\\ORM\\Tools\\Console\\Command\\ConvertMappingCommand\:\:getExporter\(\) expects string, string\|false given\.$#'
identifier: argument.type
count: 1
path: src/Tools/Console/Command/ConvertMappingCommand.php

-
message: '#^Access to an undefined property Doctrine\\Persistence\\Mapping\\ClassMetadata\:\:\$name\.$#'
identifier: property.notFound
Expand All @@ -4203,12 +4203,6 @@ parameters:
count: 1
path: src/Tools/Console/Command/GenerateEntitiesCommand.php

-
message: '#^Parameter \#2 \$outputDirectory of method Doctrine\\ORM\\Tools\\EntityGenerator\:\:generate\(\) expects string, string\|false given\.$#'
identifier: argument.type
count: 1
path: src/Tools/Console/Command/GenerateEntitiesCommand.php

-
message: '#^Access to an undefined property Doctrine\\Persistence\\Mapping\\ClassMetadata\:\:\$name\.$#'
identifier: property.notFound
Expand All @@ -4227,12 +4221,6 @@ parameters:
count: 1
path: src/Tools/Console/Command/GenerateProxiesCommand.php

-
message: '#^Parameter \#2 \$proxyDir of method Doctrine\\ORM\\Proxy\\ProxyFactory\:\:generateProxyClasses\(\) expects string\|null, string\|false given\.$#'
identifier: argument.type
count: 1
path: src/Tools/Console/Command/GenerateProxiesCommand.php

-
message: '#^Access to an undefined property Doctrine\\Persistence\\Mapping\\ClassMetadata\:\:\$customRepositoryClassName\.$#'
identifier: property.notFound
Expand All @@ -4251,12 +4239,6 @@ parameters:
count: 1
path: src/Tools/Console/Command/GenerateRepositoriesCommand.php

-
message: '#^Parameter \#2 \$outputDirectory of method Doctrine\\ORM\\Tools\\EntityRepositoryGenerator\:\:writeEntityRepositoryClass\(\) expects string, string\|false given\.$#'
identifier: argument.type
count: 1
path: src/Tools/Console/Command/GenerateRepositoriesCommand.php

-
message: '#^Method Doctrine\\ORM\\Tools\\Console\\Command\\MappingDescribeCommand\:\:formatMappings\(\) has parameter \$propertyMappings with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down
5 changes: 5 additions & 0 deletions src/Persisters/Entity/BasicEntityPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -1753,6 +1753,11 @@ public function getSelectConditionStatementSQL($field, $value, $assoc = null, $c
$value = [$value];
}

if ($value === []) {
$selectedColumns[] = '1=0';
continue;
}

$nullKeys = array_keys($value, null, true);
$nonNullValues = array_diff_key($value, array_flip($nullKeys));

Expand Down
62 changes: 62 additions & 0 deletions tests/Tests/ORM/Functional/Ticket/GH12254Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

declare(strict_types=1);

namespace Doctrine\Tests\ORM\Functional\Ticket;

use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
use Doctrine\Tests\OrmFunctionalTestCase;

class GH12254Test extends OrmFunctionalTestCase
{
protected function setUp(): void
{
parent::setUp();

$this->setUpEntitySchema([
GH12254EntityA::class,
]);

$this->_em->persist(new GH12254EntityA());
$this->_em->flush();
$this->_em->clear();
}

public function testFindByEmptyArrayShouldReturnEmptyArray(): void
{
// pretend we are starting afresh
$this->_em = $this->getEntityManager();
$result = $this->_em->getRepository(GH12254EntityA::class)->findBy(['id' => []]);
$this->assertEmpty($result);
}

public function testFindByInNullableField(): void
{
$this->_em = $this->getEntityManager();
$result = $this->_em->getRepository(GH12254EntityA::class)->findBy(['name' => []]);
$this->assertEmpty($result);
}
}

/**
* @Entity()
*/
class GH12254EntityA
{
/**
* @Column(type="integer")
* @Id()
* @GeneratedValue(strategy="AUTO")
* @var int
*/
public $id;

/**
* @Column(type="string", nullable=true)
* @var string|null
*/
public $name = null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ public function testSelectConditionStatementNeqNull(): void
self::assertEquals('test IS NOT NULL', $statement);
}

/** @group DDC-3056 */
/**
* @group DDC-3056
* @group GH12254
*/
public function testSelectConditionStatementWithMultipleValuesContainingNull(): void
{
self::assertEquals(
Expand All @@ -151,6 +154,11 @@ public function testSelectConditionStatementWithMultipleValuesContainingNull():
'(t0.id IN (?, ?) OR t0.id IS NULL)',
$this->persister->getSelectConditionStatementSQL('id', [123, null, 234])
);

self::assertEquals(
'1=0',
$this->persister->getSelectConditionStatementSQL('id', [])
);
}

public function testCountCondition(): void
Expand Down
Loading