In disable_field.module there is use of entitymanager which is deprecated in drupal 8

Comments

ahana92 created an issue. See original summary.

ahana92’s picture

Status: Active » Needs review
StatusFileSize
new806 bytes

  • ajay_reddy committed ded68ec on 8.x-1.x authored by ahana92
    Issue #2830251 by ahana92: Removing deprecated entitymanager
    
ajay_reddy’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

defconjuan’s picture

StatusFileSize
new156.94 KB

When I apply patch 2830251-2, I start getting the following error message:

Fatal error: Call to undefined method Drupal\Core\Entity\EntityTypeManager::getFieldDefinitions() in /apache/data/modules/disable_field/disable_field.module on line 47

When I restore the use of entityManager (rather than entityTypeManager), all works. What gives?

Here's more detail on the error message:
Error log

For what it's worth, replacing line 47 with the following line works (source: http://drupal.stackexchange.com/questions/226172/how-to-get-field-mappin...):

foreach (\Drupal::service('entity_field.manager')->getFieldDefinitions($form_entity_type, $bundle) as $field_name => $field_definition) {