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

Erik Frèrejean created an issue. See original summary.

erik frèrejean’s picture

Status: Active » Needs review
StatusFileSize
new2.07 KB

The fix is rather straight forward, fully implement the constructor of the ContentEntityForm.

megachriz’s picture

Status: Needs review » Fixed

At 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.

erik frèrejean’s picture

Thanks for the quick fix :)...

megachriz’s picture

Status: Fixed » Needs review
StatusFileSize
new1.04 KB

Found an issue when using Feeds on a Drupal site with 8.2.6:

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "datetime.time". in Drupal\Component\DependencyInjection\Container->get() (line 157 of core/lib/Drupal/Component/DependencyInjection/Container.php).

Attached a patch that should fix this issue.

  • MegaChriz committed ca4adf6 on 8.x-3.x
    Issue #2858738 by MegaChriz: fixed make FeedForm compatible with both...
megachriz’s picture

Status: Needs review » Fixed

And committed the fix in #6.

Status: Fixed » Closed (fixed)

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

joshmiller’s picture

Note 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:

At first, I thought placing back EntityManagerInterface in place of EntityTypeManagerInterface was wrong, because EntityManagerInterface is deprecated, but then saw that ContentEntityForm still uses EntityManagerInterface.