Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 666efc6

Browse files
committedNov 19, 2022
Add failing test
1 parent 964caf8 commit 666efc6

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed
 

‎tests/Type/Doctrine/Query/QueryResultTypeWalkerTest.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -1377,6 +1377,7 @@ public function getTestData(): iterable
13771377
[new ConstantIntegerType(6), TypeCombinator::addNull($this->numericStringOrInt())],
13781378
[new ConstantIntegerType(7), TypeCombinator::addNull(new MixedType())],
13791379
[new ConstantIntegerType(8), TypeCombinator::addNull($this->numericStringOrInt())],
1380+
[new ConstantIntegerType(9), TypeCombinator::addNull(new IntegerType())],
13801381
]),
13811382
'
13821383
SELECT IDENTITY(m.oneNull),
@@ -1386,8 +1387,10 @@ public function getTestData(): iterable
13861387
IDENTITY(m.compoundPk, \'id\'),
13871388
IDENTITY(m.compoundPk, \'version\'),
13881389
IDENTITY(m.compoundPkAssoc),
1389-
IDENTITY(m.compoundPkAssoc, \'version\')
1390+
IDENTITY(m.compoundPkAssoc, \'version\'),
1391+
IDENTITY(o.subOne)
13901392
FROM QueryResult\Entities\Many m
1393+
LEFT JOIN m.oneNull o
13911394
',
13921395
];
13931396

‎tests/Type/Doctrine/data/QueryResult/Entities/One.php

+14-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
use Doctrine\ORM\Mapping\Entity;
99
use Doctrine\ORM\Mapping\Id;
1010
use Doctrine\ORM\Mapping\JoinColumn;
11-
use Doctrine\ORM\Mapping\ManyToOne;
1211
use Doctrine\ORM\Mapping\OneToMany;
12+
use Doctrine\ORM\Mapping\OneToOne;
1313

1414
/**
1515
* @Entity
@@ -45,6 +45,14 @@ class One
4545
*/
4646
public $stringNullColumn;
4747

48+
/**
49+
* @OneToOne(targetEntity="QueryResult\Entities\SubOne", cascade={"persist"})
50+
* @JoinColumn(nullable=false)
51+
*
52+
* @var SubOne
53+
*/
54+
public $subOne;
55+
4856
/**
4957
* @OneToMany(targetEntity="QueryResult\Entities\Many", mappedBy="one")
5058
*
@@ -58,4 +66,9 @@ class One
5866
* @var Embedded
5967
*/
6068
public $embedded;
69+
70+
public function __construct()
71+
{
72+
$this->subOne = new SubOne();
73+
}
6174
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace QueryResult\Entities;
4+
5+
use Doctrine\ORM\Mapping\Column;
6+
use Doctrine\ORM\Mapping\Entity;
7+
use Doctrine\ORM\Mapping\Id;
8+
use Doctrine\ORM\Mapping\GeneratedValue;
9+
10+
/**
11+
* @Entity
12+
*/
13+
class SubOne
14+
{
15+
/**
16+
* @GeneratedValue()
17+
* @Column(type="integer")
18+
* @Id
19+
*
20+
* @var string
21+
*/
22+
public $id;
23+
}

0 commit comments

Comments
 (0)
Please sign in to comment.