Skip to content
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 phpdoc and tests for NamingStrategy #9761

Merged
merged 2 commits into from
May 16, 2022

Conversation

greg0ire
Copy link
Member

@greg0ire greg0ire commented May 14, 2022

While working on #9758, I noticed 2 things that need to be fixed.

When computing a foreign key column name, the referenced column name
may be null in the case of a self referencing entity with join columns
defined in the mapping. I wrongly introduced that phpdoc in #9756.
Also, some tests were using the fact that some arguments of some methods of
the naming strategy interface are optional or nullable for now to avoid
providing some. In practice, these arguments are always provided, and
that should also be the case in tests.

For propertyToColumnName, I think ClassMetadataInfo::$name is always a non-nullable string
See

$mapping['columnName'] = $this->namingStrategy->propertyToColumnName($mapping['fieldName'], $this->name);

For joinTableName() I think related mapping are always defined based on some property and cannot be null either.

$mapping['joinTable']['name'] = $this->namingStrategy->joinTableName($mapping['sourceEntity'], $mapping['targetEntity'], $mapping['fieldName']);

greg0ire added 2 commits May 14, 2022 16:56
When computing a foreign key column name, the referenced column name
may be null in the case of a self referencing entity with join columns
defined in the mapping.
These tests were using the fact that some arguments of some methods of
the naming strategy interface are optional or nullable for now to avoid
providing some. In practice, these arguments are always provided, and
that should also be the case in tests.
@greg0ire greg0ire changed the title Fix phpdoc for NamingStrategy Fix phpdoc and tests for NamingStrategy May 14, 2022
@greg0ire greg0ire marked this pull request as ready for review May 14, 2022 15:37
Copy link
Member

@SenseException SenseException left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrongly introduced that phpdoc in #9756.

I didn't realized that either.

@greg0ire
Copy link
Member Author

I didn't realized that either.

Yeah I think it's hard to realize until you actually conduct the actual breaking change on the next major branch 🙂

@greg0ire greg0ire merged commit 24badd6 into doctrine:2.13.x May 16, 2022
@greg0ire greg0ire deleted the fix-phpdoc-ns branch May 16, 2022 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants