Support from Acquia helps fund testing for Drupal Acquia logo

Comments

schiavone created an issue. See original summary.

schiavone’s picture

Status: Active » Needs review
FileSize
1.55 KB
sorabh.v6’s picture

Assigned: schiavone » sorabh.v6
sorabh.v6’s picture

  1. +++ b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php
    @@ -8,6 +8,8 @@
    + * @see https://www.drupal.org/node/2549139
    

    @see should be mentioned after @deprecated.

  2. +++ b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php
    @@ -15,6 +17,8 @@
        * @see \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledDefinition()
        *
    +   * @see https://www.drupal.org/node/2549139
    

    @see should be mentioned after @deprecated

  3. +++ b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php
    @@ -22,6 +26,8 @@ public function getLastInstalledDefinition($entity_type_id);
        * @see \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledFieldStorageDefinitions()
        *
    +   * @see https://www.drupal.org/node/2549139
    

    @see should be mentioned after @deprecated

Thanks for the patch file. :)

sorabh.v6’s picture

Status: Needs review » Needs work
sorabh.v6’s picture

Assigned: sorabh.v6 » Unassigned
dhruveshdtripathi’s picture

Status: Needs work » Needs review
FileSize
1.6 KB
1.67 KB

Changes made according to comment #4. Interdiff added.

Dinesh18’s picture

Status: Needs review » Needs work
   /**
+   * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *
    * @see \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledDefinition()
    *
-   * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   * @see https://www.drupal.org/node/2549139
    */
   public function getLastInstalledDefinition($entity_type_id);
 
   /**
+   * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   *
    * @see \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledFieldStorageDefinitions()
    *
-   * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
+   * @see https://www.drupal.org/node/2549139
    */
   public function getLastInstalledFieldStorageDefinitions($entity_type_id);

@see should not come twice. Instead of @see \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledFieldStorageDefinitions().
it should be Use ......
Please follow Deprecation policy

dhruveshdtripathi’s picture

Assigned: Unassigned » dhruveshdtripathi

Working on comment #8

dhruveshdtripathi’s picture

Assigned: dhruveshdtripathi » Unassigned
Status: Needs work » Needs review
FileSize
1.68 KB

Changes made according to comment #8. That was a very good suggestion.

Thank you!

Dinesh18’s picture

Status: Needs review » Reviewed & tested by the community

#10 Looks good to me. Changing the status to RTBC.
Thanks @dhruveshdtripathi for working on this.

larowlan’s picture

The @deprecated tags are duplicated on EntityManagerInterface.

We should be updating those too.

The deprecation policy says we should be adding trigger_error too - is there an issue where that is added to EntityManager?

larowlan’s picture

Status: Reviewed & tested by the community » Needs work

Confirmed we need to add the @see to the change record on the EntityManager implementations too.

In addition, we should be updating all deprecations in both the interface and class that occurred as a result of the change notice, there are quite a lot more that have been missed. Please refer to the change notice for the list.

The trigger_error is out of scope, so ignore that comment.

Dinesh18’s picture

@larowlan , it seems we need to do for all the methods mentioned in Change record.

Mentioned below :

Interface: \Drupal\Core\Entity\EntityTypeManagerInterface
Class: \Drupal\Core\Entity\EntityTypeManager
Service: entity_type.manager
Methods:
  public function getAccessControlHandler($entity_type);
  public function getStorage($entity_type);
  public function getViewBuilder($entity_type);
  public function getListBuilder($entity_type);
  public function getFormObject($entity_type, $operation);
  public function getRouteProviders($entity_type);
  public function hasHandler($entity_type, $handler_type);
  public function getHandler($entity_type, $handler_type);
  public function createHandlerInstance($class, EntityTypeInterface $definition = NULL);
  public function getDefinition($entity_type_id, $exception_on_invalid = TRUE);
  public function getDefinitions();
Interface: \Drupal\Core\Entity\EntityTypeRepositoryInterface
Class: \Drupal\Core\Entity\EntityTypeRepository
Service: entity_type.repository
Methods:
  public function getEntityTypeLabels($group = FALSE);
  public function getEntityTypeFromClass($class_name);
Interface: \Drupal\Core\Entity\EntityTypeBundleManagerInterface
Class: \Drupal\Core\Entity\EntityTypeBundleManager
Service: entity_type.bundle.info
Methods:
  public function getAllBundleInfo();
  public function getBundleInfo($entity_type);
  public function clearCachedBundles();
Interface: \Drupal\Core\Entity\EntityDisplayRepositoryInterface
Class: \Drupal\Core\Entity\EntityDisplayRepository
Service: entity_display.repository
Methods:
  public function getAllViewModes();
  public function getViewModes($entity_type_id);
  public function getAllFormModes();
  public function getFormModes($entity_type_id);
  public function getViewModeOptions($entity_type_id, $include_disabled = FALSE);
  public function getFormModeOptions($entity_type_id, $include_disabled = FALSE);
  public function getViewModeOptionsByBundle($entity_type_id, $bundle);
  public function getFormModeOptionsByBundle($entity_type_id, $bundle);
  public function clearDisplayModeInfo();
Interface: \Drupal\Core\Entity\EntityFieldManagerInterface
Class: \Drupal\Core\Entity\EntityFieldManager
Service: entity_field.manager
Methods:
  public function getBaseFieldDefinitions($entity_type_id);
  public function getFieldDefinitions($entity_type_id, $bundle);
  public function getFieldStorageDefinitions($entity_type_id);
  public function getFieldMap();
  public function setFieldMap(array $field_map);
  public function getFieldMapByFieldType($field_type);
  public function clearCachedFieldDefinitions();
  public function useCaches($use_caches = FALSE);
  public function getExtraFields($entity_type_id, $bundle);
Interface: \Drupal\Core\Entity\EntityTypeListenerInterface
Class: \Drupal\Core\Entity\EntityTypeListener
Service: entity_type.listener
Methods:
  public function onEntityTypeCreate(EntityTypeInterface $entity_type);
  public function onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeInterface $original);
  public function onEntityTypeDelete(EntityTypeInterface $entity_type);
Interface: \Drupal\Core\Entity\EntityInstalledDefinitionRepositoryInterface
Class: \Drupal\Core\Entity\EntityInstalledDefinitionRepository
Service: entity_definition.repository
Methods:
  public function getLastInstalledDefinition($entity_type_id);
  public function getLastInstalledFieldStorageDefinitions($entity_type_id);
Interface: \Drupal\Core\Entity\EntityRepositoryInterface
Class: \Drupal\Core\Entity\EntityRepository
Service: entity.repository
Methods:
  public function loadEntityByUuid($entity_type_id, $uuid);
  public function loadEntityByConfigTarget($entity_type_id, $target);
  public function getTranslationFromContext(EntityInterface $entity, $langcode = NULL, $context = array());
Interface: \Drupal\Core\Entity\EntityBundleListenerInterface
Class: \Drupal\Core\Entity\EntityBundleListener
Service: entity_bundle.listener
Methods:
  public function onBundleCreate($bundle, $entity_type_id);
  public function onBundleRename($bundle, $bundle_new, $entity_type_id);
  public function onBundleDelete($bundle, $entity_type_id);
Interface: \Drupal\Core\Field\FieldStorageDefinitionListenerInterface
Class: \Drupal\Core\Field\FieldStorageDefinitionListener
Service: field_storage_definition.listener
Methods:
  public function onFieldStorageDefinitionCreate(FieldStorageDefinitionInterface $storage_definition);
  public function onFieldStorageDefinitionUpdate(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original);
  public function onFieldStorageDefinitionDelete(FieldStorageDefinitionInterface $storage_definition);
Interface: \Drupal\Core\Field\FieldDefinitionListenerInterface
Class: \Drupal\Core\Field\FieldDefinitionListener
Service: field_definition.listener
Methods:
  public function onFieldDefinitionCreate(FieldDefinitionInterface $field_definition);
  public function onFieldDefinitionUpdate(FieldDefinitionInterface $field_definition, FieldDefinitionInterface $original);
  public function onFieldDefinitionDelete(FieldDefinitionInterface $field_definition);

#10 patch contains only for below methods :
1) getLastInstalledDefinition()
2) getLastInstalledFieldStorageDefinitions().

We need a patch which contains for all the above methods mentioned. Correct me @larowlan if I am wrong.

Mile23’s picture

The deprecation policy says we should be adding trigger_error too - is there an issue where that is added to EntityManager?

It just so happens: #2886622: Deprecate all EntityManager methods with E_USER_DEPRECATED with some other related issues you should think about if you get the chance. :-)

The scope for this issue is to add @see to change records for deprecations in EntityManagerInterface.

EntityManagerInterface currently has an interface declaration with two methods.

We should add @see to the interface docblock and both methods, since they're individually deprecated as well.

That means that the approach of #10 is correct, but it needs some work:

  1. +++ b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php
    @@ -9,20 +9,24 @@
    -   * @see \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledDefinition()
    ...
    -   * @see \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledFieldStorageDefinitions()
    

    Don't remove @see from the docblock. Group @see annotations at the end of the docblock. You'll have a @see for the method, and a @see for the change record, in each method docblock.

  2. +++ b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php
    @@ -9,20 +9,24 @@
        * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
    +   *   Use \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledDefinition()
    ...
        * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
    +   *   Use \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledFieldStorageDefinitions()
    

    It looks like you can fit 'Use' on that first line and still wrap at 80.

Mile23’s picture

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

karma0321’s picture

Issue tags: +SprintWeekend2018

Hello I'll work on this issue at Drupal Global Sprint Weekend 2018 with @jlbellido

karma0321’s picture

Status: Needs work » Needs review
FileSize
1.68 KB
1.14 KB

We fixed the 2 docblocks with the @see lines for CR and for reference, ignored the "Use" part since it's not the scope for this issue.

jpmelguizo’s picture

+++ b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php
@@ -16,16 +16,16 @@
-   *   Use \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledFieldStorageDefinitions()

Don't remove this part. According to the Drupal core deprecation policy:

"a @deprecated PHPdoc tag that indicates when the code was deprecated, when it will be removed, and what to use instead, and an @see link to the change record for the change.".

Check the examples in the Drupal core deprecation policy page.

The rest of the patch is as #15 mentions, so I think it should be fine.

karma0321’s picture

Thanks for pointing that out, here's a new patch with new fixes.

sorabh.v6’s picture

Assigned: Unassigned » sorabh.v6
sorabh.v6’s picture

Assigned: sorabh.v6 » Unassigned
Status: Needs review » Reviewed & tested by the community

Patch in #22 looks good. Setting it to RTBC.

Thanks guys.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php
@@ -9,20 +9,26 @@
+   * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. Use
+   *  \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledDefinition()
+   * instead.
...
+   * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. Use
+   *  \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledFieldStorageDefinitions()
+   * instead.

Second line indented by one and then third line not indented is certainly not a good practice. Normally we would indent 2 spaces on all subsequence lines under the initial line. I tried to find if we have some special format for @deprecated but did not find any.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

vakulrai’s picture

Status: Needs work » Needs review
FileSize
1.82 KB

@Gábor Hojtsy I have changed the indentations .

chrischaplow’s picture

Hi, @Max1muss and I are working on this issue, revising the patch.#ContributionWeekend2019

chrischaplow’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +ContributionWeekend2019

We have revised the patch #27 and the changes are ok. No other problems noticed.

alexpott credited max1mus.

alexpott’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed
+++ b/core/lib/Drupal/Core/Entity/EntityManagerInterface.php
@@ -9,20 +9,24 @@
-   * @see \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledDefinition()
+   * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. Use
+   * \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledDefinition() instead.

This needs to be indented as per our standards (unfortunately no automatic test yet). And we need to cut off after 80 chars.

So this becomes

   * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. Use
   *   \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface::getLastInstalledDefinition()
   *   instead.

  • alexpott committed 5d10756 on 8.7.x
    Issue #2873858 by karma0321, dhruveshdtripathi, schiavone, vakulrai,...
alexpott’s picture

@chrischaplow sent me an email saying that @max1mus is the wrong user. And that the user should be @max1muss - unfortunately there is no user by that name on drupal.org as far as I can find.

I've tried contact @chrischaplow via slack and drupal.org contact form but to no avail. It would be great if someone could tell me the correct user to credit.

karma0321’s picture

Hi, I think the user is Max1muss, found an existent profile page on drupal.org and the name matches the real name we know from the last contribution weekend. Hope it helps ;)

alexpott credited Max1muss.

alexpott’s picture

Ah wow - the capital M got me. Fixing. Thanks!

alexpott’s picture

Fixed git too.

Committed b332b27 and pushed to 8.7.x. Thanks!

  • alexpott committed b332b27 on 8.7.x
    Issue #2873858 by karma0321, dhruveshdtripathi, schiavone, vakulrai,...
  • alexpott committed ce01e64 on 8.7.x
    Revert "Issue #2873858 by karma0321, dhruveshdtripathi, schiavone,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.