Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/10.6' into 11.x
Browse files Browse the repository at this point in the history
# Conflicts:
#	bundles/CoreBundle/translations/pt-br.json
#	bundles/CoreBundle/translations/pt_BR.json
#	bundles/CoreBundle/translations/sv-fi.json
#	bundles/CoreBundle/translations/sv_FI.json
#	bundles/CoreBundle/translations/zh-CN.json
#	bundles/CoreBundle/translations/zh_Hans.json
#	models/DataObject/ClassDefinition/Data/AdvancedManyToManyObjectRelation.php
#	models/DataObject/ClassDefinition/Data/AdvancedManyToManyRelation.php
#	models/DataObject/ClassDefinition/Data/Classificationstore.php
#	phpstan-baseline.neon
  • Loading branch information
brusch committed Dec 20, 2022
2 parents b3bc214 + 3ccc154 commit 5faefd7
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 3,033 deletions.
2 changes: 1 addition & 1 deletion bundles/CoreBundle/config/pimcore/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ pimcore:
twig:
sandbox_security_policy:
tags: ['set']
filters: ['escape', 'trans']
filters: ['escape', 'trans', 'default']
functions: ['path', 'asset']
presta_sitemap:
# do not add properties by default
Expand Down
1,007 changes: 0 additions & 1,007 deletions bundles/CoreBundle/translations/pt-br.json

This file was deleted.

1,007 changes: 0 additions & 1,007 deletions bundles/CoreBundle/translations/sv-fi.json

This file was deleted.

1,007 changes: 0 additions & 1,007 deletions bundles/CoreBundle/translations/zh-CN.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ Please make sure to set your preferred storage location ***before*** migration.
This method will return the field/column name for the current version and provide a way to support both version for bundles.
E.g. passing `o_id` in Pimcore 10 will return `o_id`, but `id` in Pimcore 11.
- [Ecommerce] Elasticsearch 7 support has been deprecated, elasticsearch 8 supported was added.
- [ClassSavedInterface] Introduced additional interface implementing the `classSaved` method. The interface will be used by field definitions in `Pimcore\Model\DataObject\ClassDefinition\Data\*`. If your custom field definition implements the `classSaved` method, please use the `ClassSavedInterface` interface. Make sure that you either provide a default value (e.g. `$params = []`) for `$params` or don't use a second parameter in the method signature at all. Note that using the `classSaved` method without implementing the interface is deprecated and won't work in Pimcore 11.


## 10.5.10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
/**
* @method DataObject\Data\ObjectMetadata\Dao getDao()
*/
class AdvancedManyToManyObjectRelation extends ManyToManyObjectRelation implements IdRewriterInterface, PreGetDataInterface, LayoutDefinitionEnrichmentInterface
class AdvancedManyToManyObjectRelation extends ManyToManyObjectRelation implements IdRewriterInterface, PreGetDataInterface, LayoutDefinitionEnrichmentInterface, ClassSavedInterface
{
use DataObject\Traits\ElementWithMetadataComparisonTrait;
use DataObject\ClassDefinition\Data\Extension\PositionSortTrait;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
use Pimcore\Model\Element;
use Pimcore\Model\Element\ElementInterface;

class AdvancedManyToManyRelation extends ManyToManyRelation implements IdRewriterInterface, PreGetDataInterface
class AdvancedManyToManyRelation extends ManyToManyRelation implements IdRewriterInterface, PreGetDataInterface, ClassSavedInterface
{
use DataObject\Traits\ElementWithMetadataComparisonTrait;
use DataObject\ClassDefinition\Data\Extension\PositionSortTrait;
Expand Down Expand Up @@ -755,7 +755,7 @@ public function getColumnKeys(): array
return $this->columnKeys;
}

public function classSaved(DataObject\ClassDefinition $class)
public function classSaved(DataObject\ClassDefinition $class, $params = [])
{
/** @var DataObject\Data\ElementMetadata $temp */
$temp = \Pimcore::getContainer()->get('pimcore.model.factory')
Expand Down
27 changes: 27 additions & 0 deletions models/DataObject/ClassDefinition/Data/ClassSavedInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Model\DataObject\ClassDefinition\Data;

use Pimcore\Model\DataObject;

interface ClassSavedInterface
{
/**
* @param DataObject\ClassDefinition $class
* @param array $params
*/
public function classSaved($class/**, $params = [] **/);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
use Pimcore\Normalizer\NormalizerInterface;
use Pimcore\Tool;

class Classificationstore extends Data implements CustomResourcePersistingInterface, TypeDeclarationSupportInterface, NormalizerInterface, PreGetDataInterface, LayoutDefinitionEnrichmentInterface, VarExporterInterface
class Classificationstore extends Data implements CustomResourcePersistingInterface, TypeDeclarationSupportInterface, NormalizerInterface, PreGetDataInterface, LayoutDefinitionEnrichmentInterface, VarExporterInterface, ClassSavedInterface
{
use DataObject\Traits\DataHeightTrait;
use DataObject\Traits\DataWidthTrait;
Expand Down
9 changes: 7 additions & 2 deletions models/DataObject/ClassDefinition/Data/Fieldcollections.php
Original file line number Diff line number Diff line change
Expand Up @@ -636,9 +636,14 @@ public function classSaved(DataObject\ClassDefinition $class, array $params = []

foreach ($fieldDefinition as $fd) {
//TODO Pimcore 11 remove method_exists call
if (!$fd instanceof DataContainerAwareInterface && method_exists($fd, 'classSaved')) {
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));
}
// defer creation
$fd->classSaved($class);
$fd->classSaved($class, $params);
}
}

Expand Down
7 changes: 6 additions & 1 deletion models/DataObject/ClassDefinition/Data/Localizedfields.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,12 @@ public function classSaved(DataObject\ClassDefinition $class, array $params = []

foreach ($this->getFieldDefinitions() as $fd) {
//TODO Pimcore 11 remove method_exists call
if (!$fd instanceof DataContainerAwareInterface && method_exists($fd, 'classSaved')) {
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));
}
$fd->classSaved($class, $params);
}
}
Expand Down
11 changes: 7 additions & 4 deletions models/DataObject/ClassDefinition/Data/Objectbricks.php
Original file line number Diff line number Diff line change
Expand Up @@ -822,11 +822,14 @@ public function classSaved(DataObject\ClassDefinition $class, array $params = []

foreach ($fieldDefinition as $fd) {
//TODO Pimcore 11 remove method_exists call
if (method_exists($fd, 'classSaved')) {
// defer creation
if (!$fd instanceof DataContainerAwareInterface) {
$fd->classSaved($class);
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));
}
// defer creation
$fd->classSaved($class, $params);
}
}

Expand Down
7 changes: 7 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,10 @@ parameters:
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

0 comments on commit 5faefd7

Please sign in to comment.