Skip to content

Commit

Permalink
Merge branch 'hotfix/fix_deprecations_session' into 'release/2.3.0'
Browse files Browse the repository at this point in the history
Hotfix/fix deprecations session

See merge request metamodels/core!315
  • Loading branch information
zonky2 committed Aug 8, 2024
2 parents 2e7c3dd + 26cb10f commit 76f5a46
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"require": {
"php": "^8.1",
"ext-dom": "*",
"contao-community-alliance/dc-general": "^2.3.18",
"contao-community-alliance/dc-general": "^2.3.19",
"contao-community-alliance/events-contao-bindings": "^4.13.1",
"contao-community-alliance/meta-palettes": "^2.0.10",
"contao-community-alliance/translator": "^2.4.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,19 @@
*/
class JumpToListener extends AbstractAbstainingListener
{
/** @psalm-suppress MissingClassConstType */
private const DEFAULT_TYPE = UrlGeneratorInterface::ABSOLUTE_PATH;

/** @psalm-suppress MissingClassConstType */
private const TYPE_MAP = [
'absolute_url' => UrlGeneratorInterface::ABSOLUTE_URL,
'absolute_path' => UrlGeneratorInterface::ABSOLUTE_PATH,
'relative_path' => UrlGeneratorInterface::RELATIVE_PATH,
'network_path' => UrlGeneratorInterface::NETWORK_PATH,
];

/** @psalm-suppress MissingClassConstType */

private const TYPE_MAP_INVERSE = [
UrlGeneratorInterface::ABSOLUTE_URL => 'absolute_url',
UrlGeneratorInterface::ABSOLUTE_PATH => 'absolute_path',
Expand Down
2 changes: 1 addition & 1 deletion src/CoreBundle/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ services:
MetaModels\MetaModelsServiceContainer:
deprecated:
package: metamodels/core
version: 2.3
version: 2.2
message: 'The service "%service_id%" is deprecated and to be removed in MetaModels 3 - inject needed services directly.'
configurator: ['@MetaModels\CoreBundle\LegacyCompat\ServiceContainerInitializer', 'configure']
public: true
Expand Down
10 changes: 7 additions & 3 deletions src/Events/DatabaseBackedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,12 @@ protected function createInstance(CreateMetaModelEvent $event, $arrData)
*/
public function createMetaModel(CreateMetaModelEvent $event)
{
if ($event->getMetaModel() !== null) {
/** @psalm-suppress DeprecatedMethod */
if (!($metaModel = $event->getMetaModel()) instanceof ITranslatedMetaModel && $metaModel->isTranslated()) {
if (null !== ($metaModel = $event->getMetaModel())) {
/**
* @psalm-suppress DeprecatedMethod
* @psalm-suppress TooManyArguments
*/
if (!($metaModel instanceof ITranslatedMetaModel) && $metaModel->isTranslated(false)) {
// @codingStandardsIgnoreStart
@\trigger_error(
'Translated "\MetaModel\IMetamodel" instances are deprecated since MetaModels 2.2 ' .
Expand All @@ -259,6 +262,7 @@ public function createMetaModel(CreateMetaModelEvent $event)
);
// @codingStandardsIgnoreEnd
}

return;
}

Expand Down

0 comments on commit 76f5a46

Please sign in to comment.