-
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: detect if relation is oneToOne (#732)
- Loading branch information
Showing
9 changed files
with
98 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
* @author Nicolas PHILIPPE <[email protected]> | ||
*/ | ||
#[ORM\Entity] | ||
#[ORM\Table('inversed_one_to_one_with_non_nullable_owning_inverse_side')] | ||
class InverseSide | ||
{ | ||
#[ORM\Id] | ||
|
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 |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
* @author Nicolas PHILIPPE <[email protected]> | ||
*/ | ||
#[ORM\Entity] | ||
#[ORM\Table('inversed_one_to_one_with_non_nullable_owning_owning_side')] | ||
class OwningSide | ||
{ | ||
#[ORM\Id] | ||
|
23 changes: 23 additions & 0 deletions
23
tests/Fixture/Entity/EdgeCases/ManyToOneToSelfReferencing/OwningSide.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,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Zenstruck\Foundry\Tests\Fixture\Entity\EdgeCases\ManyToOneToSelfReferencing; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
/** | ||
* @author Nicolas PHILIPPE <[email protected]> | ||
*/ | ||
#[ORM\Entity] | ||
#[ORM\Table('many_to_one_to_self_referencing_owning_side')] | ||
class OwningSide | ||
{ | ||
#[ORM\Id] | ||
#[ORM\Column] | ||
#[ORM\GeneratedValue(strategy: 'AUTO')] | ||
public ?int $id = null; | ||
|
||
#[ORM\ManyToOne(inversedBy: 'owningSide')] | ||
public ?SelfReferencingInverseSide $inverseSide = null; | ||
} |
26 changes: 26 additions & 0 deletions
26
tests/Fixture/Entity/EdgeCases/ManyToOneToSelfReferencing/SelfReferencingInverseSide.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,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Zenstruck\Foundry\Tests\Fixture\Entity\EdgeCases\ManyToOneToSelfReferencing; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
/** | ||
* @author Nicolas PHILIPPE <[email protected]> | ||
*/ | ||
#[ORM\Entity] | ||
#[ORM\Table('many_to_one_to_self_referencing_inverse_side')] | ||
class SelfReferencingInverseSide | ||
{ | ||
#[ORM\Id] | ||
#[ORM\Column] | ||
#[ORM\GeneratedValue(strategy: 'AUTO')] | ||
public ?int $id = null; | ||
|
||
#[ORM\ManyToOne()] | ||
public ?SelfReferencingInverseSide $inverseSide = null; | ||
|
||
#[ORM\OneToOne(mappedBy: 'inverseSide')] | ||
public ?OwningSide $owningSide = 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