This file contains several functions which are marked as deprecated. The documentation tells you what you should use instead.

However, the thing the documentation tells you to use instead is *itself* deprecated! This needs to be fixed, so the advice is correct and up to date.

eg in entity_view()

 * @return array
 *   A render array for the entity.
 *
 * @deprecated as of Drupal 8.0.x, will be removed before Drupal 9.0.0.
 *   Use the entity view builder's view() method for creating a render array:
 * @code
 * $view_builder = \Drupal::entityManager()->getViewBuilder($entity->getEntityTypeId());
 * return $view_builder->view($entity, $view_mode, $langcode);
 * @endcode
 *
 * @see \Drupal\Core\Entity\EntityManagerInterface::getViewBuilder()
 * @see \Drupal\Core\Entity\EntityViewBuilderInterface::view()
 */
function entity_view(EntityInterface $entity, $view_mode, $langcode = NULL, $reset = FALSE) {

entityManager() is itself deprecated -- https://api.drupal.org/api/drupal/core!lib!Drupal.php/function/Drupal%3A...

Also, the use of the @code tag here is broken -- see https://api.drupal.org/api/drupal/core!includes!entity.inc/function/enti...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim created an issue. See original summary.

Vinay15’s picture

Assigned: Unassigned » Vinay15
Vinay15’s picture

Hey Joachim, will changing entityManager() to entityTypeManager() work?

joachim’s picture

For getViewBuilder(), yes. I'm not sure about any other methods though.

Vinay15’s picture

Status: Active » Needs review
FileSize
9.2 KB

I have tried to remove the deprecated functions. Correct me if I am wrong.

Status: Needs review » Needs work

The last submitted patch, 5: 2731309-5.patch, failed testing.

jhodgdon’s picture

Um, is this supposed to be a documentation issue, or a code fixing issue? It is currently in the Documentation component, meaning only documentation lines should be changed. So, this is not the right patch. Thanks!

joachim’s picture

Issue summary: View changes

Yup, this is about updating the docs.

Currently, the docs of these deprecated functions tell you to use something else, but that something else is *itself* deprecated. Updated summary.

Vinay15’s picture

Sorry for the wrong patch. I have tried to update the patch.

Vinay15’s picture

Status: Needs work » Needs review
jhodgdon’s picture

Status: Needs review » Needs work

That looks like the right things are being patched. I'll let someone else review for accuracy. Meanwhile, a lot of lines are now going over 80 characters in the latest patch, so those lines need to be rewrapped... although if a line only has a * and the name of a class on it, and still goes over 80 characters, there is no way to rewrap it so you can just leave those. Thanks!

ashishdalvi’s picture

Status: Needs work » Needs review
FileSize
10.26 KB
5.4 KB

Hi jhodgdon,

I have rewrapped all lines of above patch which exceding 80 characters.

Thanks.

jhodgdon’s picture

There is still at least one line in the patch that has a space at the end of the line, which will not be acceptable in the final patch.

And again, someone needs to review the patch for accuracy and completeness.

Vinay15’s picture

I have updated the patch.

jhodgdon’s picture

The formatting of the patch looks good now, thanks!

Please, can someone else (such as perhaps @joachim, who reported the issue?) review the patch for accuracy? Thanks!

joachim’s picture

*sigh* The change record for this change is itself out of date:

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();

It's EntityTypeBundleInfo as in the patch, not EntityTypeBundleManager.

What is the procedure for dealing with CRs with obsolete information?

joachim’s picture

Status: Needs review » Reviewed & tested by the community

All the changes in the patch look good to me.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 14: 2731309-14.patch, failed testing.

jhodgdon’s picture

Status: Needs work » Reviewed & tested by the community

Regarding out of date CRs, they should be edited. Either fix them or put a big bold note at the top saying "THIS IS OBSOLETE" and link to a more updated CR.

Back to RTBC as this is the usual Migrate test failure (which already has an issue).

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Fixing these deprecation notices is important - nice work.

Committed 5bd880c and pushed to 8.1.x and 8.2.x. Thanks!

I thought about asking for the actual implementations to be updated as it looks weird - but there are other issues for this AND it is important to have correct deprecation notices.

  • alexpott committed 7b3b072 on 8.2.x
    Issue #2731309 by Vinay15, Ashish.Dalvi, joachim, jhodgdon: docs for...

  • alexpott committed 5bd880c on 8.1.x
    Issue #2731309 by Vinay15, Ashish.Dalvi, joachim, jhodgdon: docs for...

Status: Fixed » Closed (fixed)

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