-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for duplicating parent relation columns to child tables in JTI #100
Open
peldax
wants to merge
12
commits into
cycle:4.x
Choose a base branch
from
peldax:patch-1
base: 4.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7988b08
Update Configurator.php
peldax fb0f28f
Codestyle
peldax ad29886
Implement logic to identity ownership of property
peldax 8954c01
Added comment
peldax 90989a4
Implement entity lookup in hierarchy, closes #101
peldax 300e21d
Codestyle
peldax 5b965a0
Codestyle
peldax 3b612fc
Downgrade mysql in tests to 8.0
peldax 309bf55
Fixed dataprovider deprecations introduced in phpunit 10.5.17
peldax c7ed9bd
Fix inheritance tests; revert changes in metadata reader providers
roxblnfk eba2dba
Fix data provider keys
roxblnfk 8da78c1
Add test with inherited relation
roxblnfk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Cycle\Annotated\Tests\Fixtures\Fixtures16; | ||
|
||
use Cycle\Annotated\Annotation\Entity; | ||
use Cycle\Annotated\Annotation\Inheritance\JoinedTable as InheritanceJoinedTable; | ||
|
||
/** | ||
* @Entity | ||
* @InheritanceJoinedTable(outerKey="foo_id") | ||
*/ | ||
#[Entity] | ||
#[InheritanceJoinedTable(outerKey: 'foo_id')] | ||
class Executive2 extends Executive | ||
{ | ||
} |
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,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Cycle\Annotated\Tests\Fixtures\Fixtures16; | ||
|
||
use Cycle\Annotated\Annotation\Column; | ||
use Cycle\Annotated\Annotation\Entity; | ||
use Cycle\Annotated\Annotation\Inheritance\DiscriminatorColumn; | ||
|
||
/** | ||
* @Entity | ||
* @DiscriminatorColumn(name="type") | ||
*/ | ||
#[Entity] | ||
#[DiscriminatorColumn(name: 'type')] | ||
class Tool | ||
{ | ||
/** @Column(type="primary", name="id") */ | ||
#[Column(type: 'primary', name: 'id')] | ||
public int $tool_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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added tests for this case and there is an issue when an entity extended from another entity without STI or JTI.
In thos case all the relations of the parent entity have to be cloned into the child class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is
TableInheritance
generator. It might be better to clean unnecessary relations there in cases STI or JTIThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review.
You are right, it is quite a nasty use case though. I will take a look at it in the evening,
It makes sense to clear the entity in the inheritance generator, I will try to move the logic there.
The column ownership use cases are alright?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, columns look great. Thank you.