When using feeds on a Drupal 8.3.x installation it isn't possible to create new feeds due to the following error:
The website encountered an unexpected error. Please try again later.
Error: Call to a member function getRequestTime() on null in Drupal\Core\Entity\ContentEntityForm->updateChangedTime() (line 373 of core/lib/Drupal/Core/Entity/ContentEntityForm.php).
Drupal\Core\Entity\ContentEntityForm->updateChangedTime(Object) (Line: 139)
Drupal\Core\Entity\ContentEntityForm->submitForm(Array, Object) (Line: 174)
Drupal\feeds\FeedForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 585)
Drupal\Core\Form\FormBuilder->processForm('feeds_feed_rechtspraak_nl_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm('feeds_feed_rechtspraak_nl_form', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
This issue exists due to this change in Drupal core. Which changes the $entity->setChangedTime(REQUEST_TIME); call in updateChangedTime (in the ContentEntityForm), to $entity->setChangedTime($this->time->getRequestTime()); and $this->time is never set from the feed form.
Comments
Comment #2
erik frèrejeanThe fix is rather straight forward, fully implement the constructor of the
ContentEntityForm.Comment #4
megachrizAt first, I thought placing back EntityManagerInterface in place of EntityTypeManagerInterface was wrong, because EntityManagerInterface is deprecated, but then saw that ContentEntityForm still uses EntityManagerInterface.
I also checked if the different order of parameters in the constructor is a problem, but I noticed that the "Declaration of A::method() should be compatible with that of B::method()" does not apply to constructor methods as said here: http://stackoverflow.com/questions/15413829/why-does-php-allow-incompati...
Thanks for the patch. Committed #2.
Comment #5
erik frèrejeanThanks for the quick fix :)...
Comment #6
megachrizFound an issue when using Feeds on a Drupal site with 8.2.6:
Attached a patch that should fix this issue.
Comment #8
megachrizAnd committed the fix in #6.
Comment #10
joshmillerNote there is a related core issue:
#2894261: Deprecated service entity.manager needs to be replaced with entity_type.manager in ContentEntityForm
Related to this comment: