Skip to content

Commit

Permalink
Deprecate omitting second argument to joinColumnName()
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed May 9, 2022
1 parent cbdc912 commit 37e664d
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
41 changes: 41 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
# Upgrade to 2.13

## Deprecated omitting second argument to `NamingStrategy::joinColumnName`

When implementing `NamingStrategy`, it is deprecated to implement
`joinColumnName()` with only one argument.

### Before

```php
<?php
class MyStrategy implements NamingStrategy
{
/**
* @param string $propertyName A property name.
*/
public function joinColumnName($propertyName): string
{
// …
}
}
```

### After

For backward-compatibility reasons, the parameter has to be optional, but can
be documented as guaranteed to be a `class-string`.

```php
<?php
class MyStrategy implements NamingStrategy
{
/**
* @param string $propertyName A property name.
* @param class-string $className
*/
public function joinColumnName($propertyName, $className = null): string
{
// …
}
}
```

## Deprecated methods related to named queries

The following methods have been deprecated:
Expand Down
3 changes: 3 additions & 0 deletions lib/Doctrine/ORM/Mapping/DefaultNamingStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public function referenceColumnName()

/**
* {@inheritdoc}
*
* @param string $propertyName
* @param class-string $className
*/
public function joinColumnName($propertyName, $className = null)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/NamingStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function referenceColumnName();
*
* @return string A join column name.
*/
public function joinColumnName($propertyName);
public function joinColumnName($propertyName/*, $className = null */);

/**
* Returns a join table name.
Expand Down
3 changes: 3 additions & 0 deletions lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ public function referenceColumnName()

/**
* {@inheritdoc}
*
* @param string $propertyName
* @param class-string $className
*/
public function joinColumnName($propertyName, $className = null)
{
Expand Down

0 comments on commit 37e664d

Please sign in to comment.