Problem/Motivation
Finding a major problem with a clean installation on Drupal 9
After creating a new event series it is not possible to edit an event instance. A WSOD is seen and the following is recorded in the DB Log
ArgumentCountError: Too few arguments to function Drupal\Core\Entity\ContentEntityForm::__construct(), 1 passed in /var/www/html/web/modules/contrib/recurring_events/src/Form/EventInstanceForm.php on line 69 and exactly 3 expected in Drupal\Core\Entity\ContentEntityForm->__construct() (line 56 of /var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityForm.php)
#0 /var/www/html/web/modules/contrib/recurring_events/src/Form/EventInstanceForm.php(69): Drupal\Core\Entity\ContentEntityForm->__construct(Object(Drupal\Core\Entity\EntityRepository))
#1 /var/www/html/web/modules/contrib/recurring_events/src/Form/EventInstanceForm.php(49): Drupal\recurring_events\Form\EventInstanceForm->__construct(Object(Drupal\Core\Entity\EntityRepository), Object(Drupal\Core\Messenger\Messenger), Object(Drupal\Core\Session\AccountProxy), Object(Drupal\Component\Datetime\Time))
#2 /var/www/html/web/core/lib/Drupal/Core/DependencyInjection/ClassResolver.php(28): Drupal\recurring_events\Form\EventInstanceForm::create(Object(Drupal\Core\DependencyInjection\Container))
#3 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php(226): Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition('Drupal\\recurrin...')
#4 /var/www/html/web/core/lib/Drupal/Core/Entity/HtmlEntityFormController.php(69): Drupal\Core\Entity\EntityTypeManager->getFormObject('eventinstance', 'edit')
#5 /var/www/html/web/core/lib/Drupal/Core/Controller/FormController.php(58): Drupal\Core\Entity\HtmlEntityFormController->getFormObject(Object(Drupal\Core\Routing\RouteMatch), 'eventinstance.e...')
#6 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#7 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#8 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#9 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#10 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#11 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(158): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#12 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#13 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(705): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#22 {main}
Steps to reproduce
1. Spin up a clean D9 installation and install Development version: 2.0.x-dev updated 5 Aug 2020 at 16:37 UTC
2. Create a new event series and then attempt to edit one of the event instances
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
owenbush commentedThanks for this issue. I was hoping to keep the 8.x-1.0-dev and 2.0.0-dev in sync but it's looking like something changed in D9 which means I need make the 2.0.0 release a D9 only version.
I'll get this reviewed and roll a patch
Comment #3
owenbush commentedAttached is a patch to fix this issue - it was also applicable to editing Registrants. The problem seems that the definition of the ContentEntityForm class went from having the last 2 arguments (EntityTypeBundleInfoInterface $entity_type_bundle_info and TimeInterface $time) as optional arguments, to having them as required arguments.
The good news is this patch will apply for both the D8 and D9 versions, so I may not need a version split at this point.
Comment #4
mrpauldriver commentedI haven't tested with registrants, but this fixes the problem I described in the OP.
Thank you
Comment #7
owenbush commentedThis has been merged and marked as fixed.
Comment #9
dr. gubó commentedHey, sorry for the issue necromancy, but I'm getting the very same error when trying to delete event series or instances.
"ArgumentCountError: Too few arguments to function Drupal\Core\Entity\ContentEntityForm::__construct(), 1 passed in ..."
Looking at the committed patch, maybe the same modifications need to be done to the above mentioned 2 files?
I'm on Drupal 9.1.3 and the errors happen with both current 1.x dev and 2.x dev versions of the module.
Comment #10
owenbush commentedThanks for raising the issue. I'll take a look.
Comment #11
owenbush commentedAttached is a patch to resolve the issue with event series and instance deletion
Comment #12
dr. gubó commentedThanks, I can confirm event series and event instance deletion works with the latest patch.
Might be unrelated, but on event instance deletion I see empty list items on the confirmation screen. According to the message I should see the event instance dates listed. (See image.)
All event instances get deleted properly though.
Comment #15
owenbush commentedThe issue with deletion and the missing dates has now been merged into the latest dev release of the module.