diff --git a/CHANGELOG.md b/CHANGELOG.md index a814c1fcb2..6622004890 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,9 @@ a release. --- ## [Unreleased] +### Deprecated +- Annotation-specific mapping parameters for the sluggable extension (#2837) + ### Fixed - Fix regression with `doctrine/dbal` >= 4.0 that caused MariaDB to improperly attempt LONGTEXT casting in `TranslationWalker` (issue #2887) diff --git a/doc/attributes.md b/doc/attributes.md index ebb3094f8c..c7aa0c4c70 100644 --- a/doc/attributes.md +++ b/doc/attributes.md @@ -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: @@ -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 diff --git a/src/Mapping/Annotation/Slug.php b/src/Mapping/Annotation/Slug.php index 3f240c552b..2d2c0acded 100644 --- a/src/Mapping/Annotation/Slug.php +++ b/src/Mapping/Annotation/Slug.php @@ -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 $data * @param string[] $fields - * @param SlugHandler[] $handlers + * @param SlugHandler[] $handlers @deprecated since since gedmo/doctrine-extensions 3.18 */ public function __construct( array $data = [], diff --git a/src/Mapping/Annotation/SlugHandlerOption.php b/src/Mapping/Annotation/SlugHandlerOption.php index 4acf175e1c..98086e6d79 100644 --- a/src/Mapping/Annotation/SlugHandlerOption.php +++ b/src/Mapping/Annotation/SlugHandlerOption.php @@ -21,6 +21,9 @@ * @NamedArgumentConstructor * * @author Gediminas Morkevicius + * + * @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 { diff --git a/src/Sluggable/Mapping/Driver/Attribute.php b/src/Sluggable/Mapping/Driver/Attribute.php index d1fcacafcf..0a1880fb31 100644 --- a/src/Sluggable/Mapping/Driver/Attribute.php +++ b/src/Sluggable/Mapping/Driver/Attribute.php @@ -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;