Issue #3009854 by Berdir, Wim Leers, Mile23, alexpott, andypost, tedbow, damiankloip: Fix "The "serializer.normalizer.file_entity.hal" normalizer service is deprecated: it is obsolete, it only remains available for backwards compatibility." deprecation error

merge-requests/2419/head
Alex Pott 2019-12-07 13:23:07 +00:00
parent 9c32d3168e
commit a6d5e5b57f
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
4 changed files with 7 additions and 3 deletions

View File

@ -119,6 +119,9 @@ class FileHalJsonAnonTest extends FileResourceTestBase {
/**
* @see hal_update_8501()
*
* @group legacy
* @expectedDeprecation Replacing the file uri with the URL is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use the provided url property instead and disable hal.settings:bc_file_uri_as_url_normalizer. See https://www.drupal.org/node/2925783
*/
public function testGetBcUriField() {
$this->config('hal.settings')->set('bc_file_uri_as_url_normalizer', TRUE)->save(TRUE);

View File

@ -14,7 +14,6 @@ services:
- { name: normalizer, priority: 10 }
serializer.normalizer.file_entity.hal:
class: Drupal\hal\Normalizer\FileEntityNormalizer
deprecated: 'The "%service_id%" normalizer service is deprecated: it is obsolete, it only remains available for backwards compatibility.'
arguments: ['@entity_type.manager', '@hal.link_manager', '@module_handler', '@config.factory', '@entity_type.repository', '@entity_field.manager']
tags:
- { name: normalizer, priority: 20 }

View File

@ -14,7 +14,7 @@ use Drupal\hal\LinkManager\LinkManagerInterface;
/**
* Converts the Drupal entity object structure to a HAL array structure.
*
* @deprecated in drupal:8.5.0 and is removed from drupal:9.0.0.
* @internal
*/
class FileEntityNormalizer extends ContentEntityNormalizer {
@ -61,6 +61,8 @@ class FileEntityNormalizer extends ContentEntityNormalizer {
/**
* {@inheritdoc}
*
* @deprecated in drupal:8.5.0 and is removed from drupal:9.0.0.
*/
public function normalize($entity, $format = NULL, array $context = []) {
$data = parent::normalize($entity, $format, $context);
@ -70,6 +72,7 @@ class FileEntityNormalizer extends ContentEntityNormalizer {
if ($this->halSettings->get('bc_file_uri_as_url_normalizer')) {
// Replace the file url with a full url for the file.
$data['uri'][0]['value'] = $this->getEntityUri($entity);
@trigger_error("Replacing the file uri with the URL is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use the provided url property instead and disable hal.settings:bc_file_uri_as_url_normalizer. See https://www.drupal.org/node/2925783", E_USER_DEPRECATED);
}
return $data;

View File

@ -141,7 +141,6 @@ trait DeprecationListenerTrait {
public static function getSkippedDeprecations() {
return [
'Passing in arguments the legacy way is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Provide the right parameter names in the method, similar to controllers. See https://www.drupal.org/node/2894819',
'The "serializer.normalizer.file_entity.hal" normalizer service is deprecated: it is obsolete, it only remains available for backwards compatibility.',
'The Symfony\Component\ClassLoader\ApcClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use `composer install --apcu-autoloader` instead.',
// The following deprecation is not triggered by DrupalCI testing since it
// is a Windows only deprecation. Remove when core no longer uses