Skip to content

Commit

Permalink
Deprecate annotation-specific properties in the Sluggable extension a…
Browse files Browse the repository at this point in the history
…nnotation/attribute classes
  • Loading branch information
mbabker authored Nov 11, 2024
1 parent 0ad4856 commit 22418b1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ a release.
---

## [Unreleased]
### Deprecated
- Sluggable: Annotation-specific mapping parameters (#2837)

### Fixed
- Fix regression with `doctrine/dbal` >= 4.0 that caused MariaDB to improperly attempt LONGTEXT casting in `TranslationWalker` (issue #2887)

Expand Down
7 changes: 4 additions & 3 deletions doc/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,8 @@ Optional Parameters:

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

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

Basic Example:

Expand Down Expand Up @@ -552,8 +553,8 @@ class Article

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

The `SlugHandlerOption` attribute is not supported when using attributes for configuration. Instead, the options
can be configured directly in the `SlugHandler` attribute's **options** parameter.
> [!WARNING]
> 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.
### Soft Deleteable Extension

Expand Down
10 changes: 8 additions & 2 deletions src/Mapping/Annotation/Slug.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,20 @@ final class Slug implements GedmoAnnotation
public string $separator = '-';
public string $prefix = '';
public string $suffix = '';
/** @var SlugHandler[] */

/**
* @var SlugHandler[]
*
* @deprecated since gedmo/doctrine-extensions 3.18
*/
public $handlers = [];

public string $dateFormat = 'Y-m-d-H:i';

/**
* @param array<string, mixed> $data
* @param string[] $fields
* @param SlugHandler[] $handlers
* @param SlugHandler[] $handlers @deprecated since since gedmo/doctrine-extensions 3.18
*/
public function __construct(
array $data = [],
Expand Down
3 changes: 3 additions & 0 deletions src/Mapping/Annotation/SlugHandlerOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* @NamedArgumentConstructor
*
* @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
*
* @deprecated since gedmo/doctrine-extensions 3.18, will be removed in version 4.0. Configure the options as
* an associative array on the {@see SlugHandler} attribute instead.
*/
final class SlugHandlerOption implements GedmoAnnotation
{
Expand Down
2 changes: 2 additions & 0 deletions src/Sluggable/Mapping/Driver/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class Attribute extends AbstractAnnotationDriver

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

Expand Down

0 comments on commit 22418b1

Please sign in to comment.