Skip to content

Commit

Permalink
Merge 1.x into 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI authored Aug 3, 2023
2 parents 84c72e9 + 8f11cb1 commit dc45b90
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/Fixtures/Relation/OwnedEntity2.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class OwnedEntity2
* @var OwnerEntity|null
*/
#[ORM\ManyToOne(targetEntity: OwnerEntity::class)]
#[ORM\JoinColumn(name: 'owner_id_goes_here', referencedColumnName: 'some_strange_key_name')]
#[ORM\JoinColumn(name: 'owner_id_goes_here', referencedColumnName: 'some_strange_key_name', onDelete: 'SET NULL')]
protected $owner;

public function getId(): ?int
Expand Down
10 changes: 7 additions & 3 deletions tests/RelationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,21 @@ public function testUndefinedIndexesInUOWForRelations(): void

$em->flush();

$ownerId = $owner->getId();
$ownedId1 = $owned1->getId();
$ownedId2 = $owned2->getId();

unset($owner, $owned1, $owned2);

$em->clear();

$owner = $em->getReference(OwnerEntity::class, 1);
$owner = $em->getReference(OwnerEntity::class, $ownerId);
static::assertNotNull($owner);
$em->remove($owner);
$owned1 = $em->getReference(OwnedEntity1::class, 1);
$owned1 = $em->getReference(OwnedEntity1::class, $ownedId1);
static::assertNotNull($owned1);
$em->remove($owned1);
$owned2 = $em->getReference(OwnedEntity2::class, 1);
$owned2 = $em->getReference(OwnedEntity2::class, $ownedId2);
static::assertNotNull($owned2);
$em->remove($owned2);

Expand Down

0 comments on commit dc45b90

Please sign in to comment.