Hi @yuriseki,

I have successfully created a scheduled task using the action: Schedule a task to delete a node with a specific nid.

However, when I try to manually 'execute' the action from /admin/config/workflow/business_rules/schedule/execute/2, the below error is generated on a white dead screen:

Fatal error: Drupal\business_rules\Controller\ScheduleController::execute(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Drupal\business_rules\Events\BusinessRulesEvent" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in \web\modules\contrib\business_rules\src\Controller\ScheduleController.php on line 135

Thank you,

Comments

C.E.A created an issue. See original summary.

c.e.a’s picture

Assigned: Unassigned » yseki
manfye’s picture

so what is the solution?

colan’s picture

Assigned: yseki » Unassigned
Priority: Critical » Major
Status: Needs work » Active

Updating status as there's no code here. Also, this is definitely not critical as the module works fine if not using tasks.

Patches welcome as this isn't currently affecting any of the maintainers.

yseki’s picture

Status: Active » Needs review
StatusFileSize
new1.22 KB

It was using an object that could be empty.

Here's a patch.

  • yuriseki committed a43d9cc on 8.x-1.x
    Issue #3043803 by yuriseki, C.E.A, manfye, colan: Execute a scheduled...
deciphered’s picture

StatusFileSize
new628 bytes

So this patch doesn't seem to resolve the issue for me. And from what I can tell, this patch doesn't resolve the underlying issue of the Incomplete class.

Simple enough fix, as per https://stackoverflow.com/questions/965611/forcing-access-to-php-incompl... Serializing and unserialzing the object resolves the issue (for me).

Patch attached.

GavZav’s picture

The website encountered an unexpected error. Please try again later.
Error: Call to a member function getSubject() on boolean in Drupal\business_rules\Entity\Schedule::executeSchedule() (line 424 of modules/contrib/business_rules/src/Entity/Schedule.php).
Drupal\business_rules\Entity\Schedule::executeSchedule(Object) (Line: 481)
business_rules_cron()
call_user_func_array('business_rules_cron', Array) (Line: 392)
Drupal\Core\Extension\ModuleHandler->invoke('business_rules', 'cron') (Line: 236)
Drupal\Core\Cron->invokeCronHandlers() (Line: 134)
Drupal\Core\Cron->run() (Line: 75)
Drupal\Core\ProxyClass\Cron->run() (Line: 271)
Drupal\admin_toolbar_tools\Controller\ToolbarController->runCron()
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
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}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
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: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 694)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)