diff --git a/doc/Development_Documentation/23_Installation_and_Upgrade/09_Upgrade_Notes/README.md b/doc/Development_Documentation/23_Installation_and_Upgrade/09_Upgrade_Notes/README.md index ecbc4983d87..8bfa79de46b 100644 --- a/doc/Development_Documentation/23_Installation_and_Upgrade/09_Upgrade_Notes/README.md +++ b/doc/Development_Documentation/23_Installation_and_Upgrade/09_Upgrade_Notes/README.md @@ -114,6 +114,7 @@ Please make sure to set your preferred storage location ***before*** migration. - [Ecommerce][IndexService] Please make sure to rebuild your product index to make sure changes apply accordingly (this is relevant for mysql and elasticsearch indices). As an alternative you could manually rename and remove `o_` from all index columns/fields. - [Ecommerce] Elasticsearch 7 support was removed - [Ecommerce] Config option `es_client_params` in `index_service` was removed +- [ClassSavedInterface] Removed `method_exists` bc layer. Please add the corresponding `ClassSavedInterface` interface to your custom field definitions. For more details check the 10.6.0 patch notes. ## 10.6.0 - [AreabrickManagerInterface] The `enable`, `disable`, `isEnabled` and `getState` methods of `Pimcore\Extension\Document\Areabrick\AreabrickManagerInterface` are deprecated as maintaining state of extensions is deprecated. This impacts `\Pimcore\Document\Editable\EditableHandler::isBrickEnabled()` method which is also deprecated. diff --git a/models/DataObject/ClassDefinition/Data/AdvancedManyToManyRelation.php b/models/DataObject/ClassDefinition/Data/AdvancedManyToManyRelation.php index 49849d391ca..8664a9f9c06 100644 --- a/models/DataObject/ClassDefinition/Data/AdvancedManyToManyRelation.php +++ b/models/DataObject/ClassDefinition/Data/AdvancedManyToManyRelation.php @@ -755,7 +755,7 @@ public function getColumnKeys(): array return $this->columnKeys; } - public function classSaved(DataObject\ClassDefinition $class, $params = []) + public function classSaved(DataObject\ClassDefinition $class, array $params = []) { /** @var DataObject\Data\ElementMetadata $temp */ $temp = \Pimcore::getContainer()->get('pimcore.model.factory') diff --git a/models/DataObject/ClassDefinition/Data/ClassSavedInterface.php b/models/DataObject/ClassDefinition/Data/ClassSavedInterface.php index 8143cde179e..aa60aa7d88b 100644 --- a/models/DataObject/ClassDefinition/Data/ClassSavedInterface.php +++ b/models/DataObject/ClassDefinition/Data/ClassSavedInterface.php @@ -19,9 +19,5 @@ interface ClassSavedInterface { - /** - * @param DataObject\ClassDefinition $class - * @param array $params - */ - public function classSaved($class/**, $params = [] **/); + public function classSaved(DataObject\ClassDefinition $class, array $params = []); } diff --git a/models/DataObject/ClassDefinition/Data/Fieldcollections.php b/models/DataObject/ClassDefinition/Data/Fieldcollections.php index 4335e5cf7dd..da4a58d1d9f 100644 --- a/models/DataObject/ClassDefinition/Data/Fieldcollections.php +++ b/models/DataObject/ClassDefinition/Data/Fieldcollections.php @@ -635,13 +635,7 @@ public function classSaved(DataObject\ClassDefinition $class, array $params = [] $fieldDefinition = $definition->getFieldDefinitions(); foreach ($fieldDefinition as $fd) { - //TODO Pimcore 11 remove method_exists call - if (!$fd instanceof DataContainerAwareInterface && ($fd instanceof ClassSavedInterface || method_exists($fd, 'classSaved'))) { - if (!$fd instanceof ClassSavedInterface) { - trigger_deprecation('pimcore/pimcore', '10.6', - sprintf('Usage of method_exists is deprecated since version 10.6 and will be removed in Pimcore 11.' . - 'Implement the %s interface instead.', ClassSavedInterface::class)); - } + if ($fd instanceof ClassSavedInterface) { // defer creation $fd->classSaved($class, $params); } diff --git a/models/DataObject/ClassDefinition/Data/Localizedfields.php b/models/DataObject/ClassDefinition/Data/Localizedfields.php index ecba7235b52..fb4782df1a9 100644 --- a/models/DataObject/ClassDefinition/Data/Localizedfields.php +++ b/models/DataObject/ClassDefinition/Data/Localizedfields.php @@ -500,13 +500,7 @@ public function classSaved(DataObject\ClassDefinition $class, array $params = [] $localizedFields->createUpdateTable($params); foreach ($this->getFieldDefinitions() as $fd) { - //TODO Pimcore 11 remove method_exists call - if (!$fd instanceof DataContainerAwareInterface && ($fd instanceof ClassSavedInterface || method_exists($fd, 'classSaved'))) { - if (!$fd instanceof ClassSavedInterface) { - trigger_deprecation('pimcore/pimcore', '10.6', - sprintf('Usage of method_exists is deprecated since version 10.6 and will be removed in Pimcore 11.' . - 'Implement the %s interface instead.', ClassSavedInterface::class)); - } + if ($fd instanceof ClassSavedInterface) { $fd->classSaved($class, $params); } } diff --git a/models/DataObject/ClassDefinition/Data/Objectbricks.php b/models/DataObject/ClassDefinition/Data/Objectbricks.php index c799ec9ea98..01719847bcc 100644 --- a/models/DataObject/ClassDefinition/Data/Objectbricks.php +++ b/models/DataObject/ClassDefinition/Data/Objectbricks.php @@ -821,13 +821,7 @@ public function classSaved(DataObject\ClassDefinition $class, array $params = [] $fieldDefinition = $definition->getFieldDefinitions(); foreach ($fieldDefinition as $fd) { - //TODO Pimcore 11 remove method_exists call - if (!$fd instanceof DataContainerAwareInterface && ($fd instanceof ClassSavedInterface || method_exists($fd, 'classSaved'))) { - if (!$fd instanceof ClassSavedInterface) { - trigger_deprecation('pimcore/pimcore', '10.6', - sprintf('Usage of method_exists is deprecated since version 10.6 and will be removed in Pimcore 11.' . - 'Implement the %s interface instead.', ClassSavedInterface::class)); - } + if ($fd instanceof ClassSavedInterface) { // defer creation $fd->classSaved($class, $params); } diff --git a/models/DataObject/Traits/ClassSavedTrait.php b/models/DataObject/Traits/ClassSavedTrait.php index e00aa225ce3..157f4876cd8 100644 --- a/models/DataObject/Traits/ClassSavedTrait.php +++ b/models/DataObject/Traits/ClassSavedTrait.php @@ -31,7 +31,7 @@ public function preSave(mixed $containerDefinition, array $params = []): void public function postSave(mixed $containerDefinition, array $params = []): void { if ($containerDefinition instanceof ClassDefinition) { - $this->classSaved($containerDefinition); + $this->classSaved($containerDefinition, $params); } } } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index afa7a167ddf..5d9ce1af46f 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -193,12 +193,4 @@ parameters: - message: "#^Parameter \\#1 \\$children of method Pimcore\\\\Model\\\\Document\\:\\:setChildren\\(\\) expects array\\\\|null, array\\ given\\.$#" count: 1 - path: models/Document/Hardlink/Wrapper/Snippet.php - - - - - message: "#^PHPDoc tag \\@param references unknown parameter\\: \\$params$#" - paths: - - models/DataObject/ClassDefinition/Data/AdvancedManyToManyObjectRelation.php - - models/DataObject/ClassDefinition/Data/ClassSavedInterface.php - - models/DataObject/ClassDefinition/Data/Classificationstore.php \ No newline at end of file + path: models/Document/Hardlink/Wrapper/Snippet.php \ No newline at end of file