Skip to content

Commit 22418b1

Browse files
authored
Deprecate annotation-specific properties in the Sluggable extension annotation/attribute classes
1 parent 0ad4856 commit 22418b1

File tree

5 files changed

+20
-5
lines changed

5 files changed

+20
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ a release.
1818
---
1919

2020
## [Unreleased]
21+
### Deprecated
22+
- Sluggable: Annotation-specific mapping parameters (#2837)
23+
2124
### Fixed
2225
- Fix regression with `doctrine/dbal` >= 4.0 that caused MariaDB to improperly attempt LONGTEXT casting in `TranslationWalker` (issue #2887)
2326

doc/attributes.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,8 @@ Optional Parameters:
474474

475475
- **suffix** - An optional suffix for the generated slug
476476

477-
- **handlers** - Unused with attributes
477+
- **handlers** - Deprecated to be removed in 4.0, this parameter is unused with attributes in favor of
478+
the `SlugHandler` attribute
478479

479480
Basic Example:
480481

@@ -552,8 +553,8 @@ class Article
552553

553554
#### `#[Gedmo\Mapping\Annotation\SlugHandlerOption]`
554555

555-
The `SlugHandlerOption` attribute is not supported when using attributes for configuration. Instead, the options
556-
can be configured directly in the `SlugHandler` attribute's **options** parameter.
556+
> [!WARNING]
557+
> The `SlugHandlerOption` attribute is deprecated and will be removed in 4.0. Using this attribute is not supported, and instead, the options can be configured directly in the `SlugHandler` attribute's **options** parameter.
557558
558559
### Soft Deleteable Extension
559560

src/Mapping/Annotation/Slug.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,20 @@ final class Slug implements GedmoAnnotation
4444
public string $separator = '-';
4545
public string $prefix = '';
4646
public string $suffix = '';
47-
/** @var SlugHandler[] */
47+
48+
/**
49+
* @var SlugHandler[]
50+
*
51+
* @deprecated since gedmo/doctrine-extensions 3.18
52+
*/
4853
public $handlers = [];
54+
4955
public string $dateFormat = 'Y-m-d-H:i';
5056

5157
/**
5258
* @param array<string, mixed> $data
5359
* @param string[] $fields
54-
* @param SlugHandler[] $handlers
60+
* @param SlugHandler[] $handlers @deprecated since since gedmo/doctrine-extensions 3.18
5561
*/
5662
public function __construct(
5763
array $data = [],

src/Mapping/Annotation/SlugHandlerOption.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
* @NamedArgumentConstructor
2222
*
2323
* @author Gediminas Morkevicius <[email protected]>
24+
*
25+
* @deprecated since gedmo/doctrine-extensions 3.18, will be removed in version 4.0. Configure the options as
26+
* an associative array on the {@see SlugHandler} attribute instead.
2427
*/
2528
final class SlugHandlerOption implements GedmoAnnotation
2629
{

src/Sluggable/Mapping/Driver/Attribute.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ class Attribute extends AbstractAnnotationDriver
3838

3939
/**
4040
* Mapping object configuring an option for a slug handler.
41+
*
42+
* @deprecated since gedmo/doctrine-extensions 3.18, will be removed in version 4.0.
4143
*/
4244
public const HANDLER_OPTION = SlugHandlerOption::class;
4345

0 commit comments

Comments
 (0)