Problem

The EntityForm::setEntityManager has a deprecation notice that states that EntityForm::setEntityTypeManager is deprecated, pointing to use EntityFormInterface::setEntityTypeManager instead. This message can be confusing.

The deprecation error should state that EntityForm::setEntityManager (which triggers the error) is deprecated and not EntityForm::setEntityTypeManager (which will not be removed in 9.0).

Solution

Replace the error_msg on line 464 of core/lib/Drupal/Core/Entity/EntityForm.php with EntityForm::setEntityManager() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use EntityFormInterface::setEntityTypeManager() instead. See https://www.drupal.org/node/2549139

Comments

Kingdutch created an issue. See original summary.

jyotimishra-developer’s picture

Assigned: Unassigned » jyotimishra-developer
jyotimishra-developer’s picture

Assigning myself to work on this

jyotimishra-developer’s picture

StatusFileSize
new1.03 KB
jyotimishra-developer’s picture

please have a review the patch in #4

jyotimishra-developer’s picture

Assigned: jyotimishra-developer » Unassigned
himanshu_sindhwani’s picture

Status: Active » Needs review
StatusFileSize
new1.24 KB

It seems to me the error is just right but the function where I should be triggered is wrong, just corrected it.

Status: Needs review » Needs work

The last submitted patch, 7: 3142943-7.patch, failed testing. View results

ankitsingh0188’s picture

Assigned: Unassigned » ankitsingh0188
ankitsingh0188’s picture

Assigned: ankitsingh0188 » Unassigned
Status: Needs work » Needs review
StatusFileSize
new981 bytes
new697 bytes

Created the patch with the latest code of the module.
Created a patch to modify the incorrect deprecation notice.

Status: Needs review » Needs work

The last submitted patch, 10: 3142943-10.patch, failed testing. View results

himanshu_sindhwani’s picture

Status: Needs work » Needs review
StatusFileSize
new2.87 KB

Adding the deprecated warning to both EntityForm::setEntityManager and EntityForm::setEntityTypeManager and updating test cases.

Status: Needs review » Needs work

The last submitted patch, 12: 3142943-12.patch, failed testing. View results

himanshu_sindhwani’s picture

Status: Needs work » Needs review
StatusFileSize
new1.91 KB
new844 bytes

Maybe we should create a different issue to add a deprecation warning for EntityForm::setEntityTypeManager, So here correcting the test failure in #10.

Rkumar’s picture

Issue tags: +Discussion Post

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...

Though this is going to be depricated in D9
EntityForm::setEntityManager()

As well as this URL also https://www.drupal.org/node/2549139 needs to be updated for EntityForm::setEntityManager()

Rkumar’s picture

I am not sure about the proper tag but yes more inputs are required for this update.

dpovshed’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Discussion Post

I had recently spotted the same issue and the patch in #14 worked perfectly. Despite it is about a year old it is perfectly applicable and eliminates misleading message.

* marking this as RTBC;
* removing the 'Discussion Post' tag - if there is really something to discuss it is advisable to reuse any of the standard tags.

catch’s picture

Version: 8.9.x-dev » 9.2.x-dev
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll
ravi.shankar’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs reroll

@catch I think reroll of patch #14 on Drupal 9.2.x is not possible because the deprecated setEntityManager() method is removed in https://www.drupal.org/project/drupal/issues/3087546 this issue.

Please correct me if I am wrong.

So removing the Needs reroll tag and back to RTBC as per comment #17.

ravi.shankar’s picture

Version: 9.2.x-dev » 8.9.x-dev

Back to the 8.9.x version.

  • catch committed 802b06b on 8.9.x
    Issue #3142943 by himanshu_sindhwani, ankitsingh0188, jyotimishra123,...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Oh I see, was confused by the 9.2 test in #14. We are not really committing minor issues to 8.9.x, but since this is specifically about deprecation documentation, let's get it in.

Committed/pushed to 8.9.x, thanks!

Status: Fixed » Closed (fixed)

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