-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10648 from doctrine/2.14.x-merge-up-into-2.15.x_V…
…ZV5I0St Merge release 2.14.3 into 2.15.x
- Loading branch information
Showing
17 changed files
with
277 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\Models\GH7717; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
/** | ||
* @ORM\Entity | ||
* @ORM\Table(name="gh7717_children") | ||
*/ | ||
class GH7717Child | ||
{ | ||
/** | ||
* @ORM\Id | ||
* @ORM\Column(type="integer") | ||
* @ORM\GeneratedValue | ||
*/ | ||
public ?int $id = null; | ||
|
||
/** | ||
* @ORM\Column(type="string", nullable=true) | ||
*/ | ||
public ?string $nullableProperty = null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\Models\GH7717; | ||
|
||
use Doctrine\Common\Collections\Selectable; | ||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
/** | ||
* @ORM\Entity | ||
* @ORM\Table(name="gh7717_parents") | ||
*/ | ||
class GH7717Parent | ||
{ | ||
/** | ||
* @ORM\Id | ||
* @ORM\Column(type="integer") | ||
* @ORM\GeneratedValue | ||
*/ | ||
public ?int $id = null; | ||
|
||
/** | ||
* @ORM\ManyToMany(targetEntity="GH7717Child", cascade={"persist"}) | ||
* | ||
* @var Selectable<int, GH7717Child> | ||
*/ | ||
public Selectable $children; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\Models\Project; | ||
|
||
class Project | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $id; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $name; | ||
|
||
public function __construct(string $id, string $name) | ||
{ | ||
$this->id = $id; | ||
$this->name = $name; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\Models\Project; | ||
|
||
class ProjectId | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $id; | ||
|
||
public function __construct(string $id) | ||
{ | ||
$this->id = $id; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
tests/Doctrine/Tests/Models/Project/ProjectInvalidMapping.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\Models\Project; | ||
|
||
class ProjectInvalidMapping | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $id; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $name; | ||
|
||
public function __construct(string $id, string $name) | ||
{ | ||
$this->id = $id; | ||
$this->name = $name; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\Models\Project; | ||
|
||
final class ProjectName | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $name; | ||
|
||
public function __construct(string $name) | ||
{ | ||
$this->name = $name; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\ORM\Functional\Ticket; | ||
|
||
use Doctrine\Common\Collections\ArrayCollection; | ||
use Doctrine\Common\Collections\Criteria; | ||
use Doctrine\Tests\Models\GH7717\GH7717Child; | ||
use Doctrine\Tests\Models\GH7717\GH7717Parent; | ||
use Doctrine\Tests\OrmFunctionalTestCase; | ||
|
||
/** | ||
* @requires PHP 7.4 | ||
*/ | ||
final class GH7717Test extends OrmFunctionalTestCase | ||
{ | ||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->createSchemaForModels( | ||
GH7717Parent::class, | ||
GH7717Child::class | ||
); | ||
} | ||
|
||
public function testManyToManyPersisterIsNullComparison(): void | ||
{ | ||
$childWithNullProperty = new GH7717Child(); | ||
$childWithoutNullProperty = new GH7717Child(); | ||
$childWithoutNullProperty->nullableProperty = 'nope'; | ||
|
||
$parent = new GH7717Parent(); | ||
$parent->children = new ArrayCollection([$childWithNullProperty, $childWithoutNullProperty]); | ||
|
||
$this->_em->persist($parent); | ||
$this->_em->flush(); | ||
$this->_em->clear(); | ||
|
||
$parent = $this->_em->find(GH7717Parent::class, 1); | ||
|
||
$this->assertCount(1, $parent->children->matching(new Criteria(Criteria::expr()->isNull('nullableProperty')))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
tests/Doctrine/Tests/ORM/Mapping/xml/Doctrine.Tests.Models.Project.Project.dcm.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping | ||
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> | ||
<entity name="Doctrine\Tests\Models\Project\Project" table="project"> | ||
<id name="id" type="Doctrine\Tests\Models\Project\ProjectId" column="id"> | ||
<generator strategy="NONE"/> | ||
</id> | ||
<field name="name" type="Doctrine\Tests\Models\Project\ProjectName" column="name"/> | ||
</entity> | ||
</doctrine-mapping> |
12 changes: 12 additions & 0 deletions
12
...octrine/Tests/ORM/Mapping/xml/Doctrine.Tests.Models.Project.ProjectInvalidMapping.dcm.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping | ||
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> | ||
<entity name="Doctrine\Tests\Models\Project\ProjectInvalidMapping" table="project"> | ||
<id name="id" type="Doctrine/Tests/Models/Project/Project/ProjectId" column="id"> | ||
<generator strategy="NONE"/> | ||
</id> | ||
<field name="name" type="Doctrine/Tests/Models/Project/Project/ProjectName" column="name"/> | ||
</entity> | ||
</doctrine-mapping> |
Oops, something went wrong.