Skip to content

Commit

Permalink
[Task] Enabled $param parameter for classSaved method in `classSavedI…
Browse files Browse the repository at this point in the history
…nterface` (pimcore#13857)

* enabled $param parameter for classSaved method

* removed ignored error

* pass $params to classSaved method in postSave trait

* removed deprecated code

* added upgrade notes

* Update doc/Development_Documentation/23_Installation_and_Upgrade/09_Upgrade_Notes/README.md

Co-authored-by: mcop1 <[email protected]>

Co-authored-by: mcop1 <[email protected]>
  • Loading branch information
Corepex and mcop1 authored Dec 20, 2022
1 parent 9de7216 commit 51c29d5
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []);
}
8 changes: 1 addition & 7 deletions models/DataObject/ClassDefinition/Data/Fieldcollections.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 1 addition & 7 deletions models/DataObject/ClassDefinition/Data/Localizedfields.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
8 changes: 1 addition & 7 deletions models/DataObject/ClassDefinition/Data/Objectbricks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion models/DataObject/Traits/ClassSavedTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
10 changes: 1 addition & 9 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,4 @@ parameters:
-
message: "#^Parameter \\#1 \\$children of method Pimcore\\\\Model\\\\Document\\:\\:setChildren\\(\\) expects array\\<Pimcore\\\\Model\\\\Document\\>\\|null, array\\<int, Pimcore\\\\Model\\\\Document\\\\Hardlink\\\\Wrapper\\\\WrapperInterface\\> 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
path: models/Document/Hardlink/Wrapper/Snippet.php

0 comments on commit 51c29d5

Please sign in to comment.