Guys,

I would love this module to work. It's so much better than the Rules module!

However, it doesn't work at all on my set up, which is :
- Devdesktop
- Drupal 8.6.1
- PHP 7.1.11

Install is smooth, but when I create a simple business rule (unconditional page redirect upon entity insert (User)), I get a PHP warning (see below). Adding conditions to the business rule gives PHP warnings as well. This results in the business rule not being applied. I tried adding conditions as well, however all result in PHP warnings.

Thanks in advance for a swift solution (I really need this module!)

==================

Location http://drupal-8-5-6.dd:8083/admin/config/workflow/business_rules/add?_wr...

Referrer http://drupal-8-5-6.dd:8083/admin/config/workflow/business_rules/add

Message Warning: implode(): Invalid arguments passed in Drupal\business_rules\Form\BusinessRuleForm->form() (line 143 of C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\modules\business_rules\src\Form\BusinessRuleForm.php) #0 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\core\includes\bootstrap.inc(584): _drupal_error_handler_real(2, 'implode(): Inva...', 'C:\\Users\\Admini...', 143, Array) #1 [internal function]: _drupal_error_handler(2, 'implode(): Inva...', 'C:\\Users\\Admini...', 143, Array) #2 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\modules\business_rules\src\Form\BusinessRuleForm.php(143): implode(', ', '') #3 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\core\lib\Drupal\Core\Entity\EntityForm.php(117): Drupal\business_rules\Form\BusinessRuleForm->form(Array, Object(Drupal\Core\Form\FormState)) #4 [internal function]: Drupal\Core\Entity\EntityForm->buildForm(Array, Object(Drupal\Core\Form\FormState)) #5 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\core\lib\Drupal\Core\Form\FormBuilder.php(518): call_user_func_array(Array, Array) #6 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\core\lib\Drupal\Core\Form\FormBuilder.php(368): Drupal\Core\Form\FormBuilder->retrieveForm('business_rule_a...', Object(Drupal\Core\Form\FormState)) #7 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\core\lib\Drupal\Core\Form\FormBuilder.php(625): Drupal\Core\Form\FormBuilder->rebuildForm('business_rule_a...', Object(Drupal\Core\Form\FormState), Array) #8 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\core\lib\Drupal\Core\Form\FormBuilder.php(318): Drupal\Core\Form\FormBuilder->processForm('business_rule_a...', Array, Object(Drupal\Core\Form\FormState)) #9 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\core\lib\Drupal\Core\Controller\FormController.php(93): Drupal\Core\Form\FormBuilder->buildForm('business_rule_a...', Object(Drupal\Core\Form\FormState)) #10 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #11 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #12 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\core\lib\Drupal\Core\Render\Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #13 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #14 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #15 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\vendor\symfony\http-kernel\HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #16 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\vendor\symfony\http-kernel\HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #17 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\core\lib\Drupal\Core\StackMiddleware\Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\core\modules\page_cache\src\StackMiddleware\PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\core\modules\page_cache\src\StackMiddleware\PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\vendor\stack\builder\src\Stack\StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\core\lib\Drupal\Core\DrupalKernel.php(665): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 C:\Users\Administrator\Sites\devdesktop\drupal-8.5.6\index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #26 {main}.

Comments

dendreten created an issue. See original summary.

yseki’s picture

Assigned: Unassigned » yseki

Hi @dendreten,

I'm taking a look on this issue.

yseki’s picture

Status: Active » Postponed (maintainer needs more info)

I could reproduce this behavior only by updating to Drupal 8.6.1.
The way I've fixed it on my environment was by running:

drush cr
composer update

Can you try to clear your cache and then running composer update?

Let me know if it works for you.

dendreten’s picture

Yes, this worked in the end. Thanks.

(I thought it didn't as I had issues, but in the end, those were due to a conflict with DEVEL, so I made another ticket for that one).

dendreten’s picture

update : I accidentally saved a rule which caused too many redirects. The only way to get back to a working situation was to uninstall the module using drush.

After uninstallation, I tried to reinstall Business Rules several times using GUI, drush, composer. Did a couple of composer updates and many cache refreshes, but never managed to get back to a working module...

yseki’s picture

There is a feature called safe mode which is explained in the Business Rules project page, that allows you to bypass the rules processing. It was made to be used in this kind of situation. All you need to do is to include the ?brmode=safe on the URL.

Now, for this case you are describing, that you are not being able to reinstall de module after uninstall, it's weird because when the module is uninstalled, the files remain on the module directory, and all you were supposed to do was to enable it by Drush or GUI.

The occasions that it may occur are related to some yml file on the module config/install directory that creates some entity, but the only yml files on Business Rules that are on config/install directory are related to configuration, not entities. All entities are on config/optional directory, that means if the entity already exists, it will not try to recreate it.

If you are still having issues, reach me on Skype using my username followed by gmail and I can help you.

dendreten’s picture

disregard this last comment (just removed).

I had various issues with my set up. Reinstalled everything and now things run smoother.

yseki’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

good to know it's ok now.

pyxio’s picture

sorry but this issue is not closed. we need to find out why it works for some people and not others. thank you

pyxio’s picture

no emails are sent and broken on a commerce site. this is hardly a beta module and should be alpha. awesome potential but still very broken.

remyyyyy’s picture

After adding this modifications to the file modules/contrib/business_rules/src/Form/BusinessRuleForm.php Line 140 :

      $form['tags'] = [
        '#type'                          => 'textfield',
        '#title'                         => $this->t('Tags'),
//        '#default_value'                 => implode(', ', $business_rule->getTags()),
		'#default_value'                 => (is_array($business_rule->getTags()) && count($business_rule->getTags())) ? implode(', ', $business_rule->getTags()) : '',
        '#description'                   => $this->t('List of comma-separated tags.'),
        '#required'                      => FALSE,
        '#autocomplete_route_name'       => 'business_rules.autocomplete_tags',
        '#autocomplete_route_parameters' => [],

      ];

And /modules/contrib/business_rules/src/Form/ItemForm.php Line 150 :

      $form['tags'] = [
        '#type'                          => 'textfield',
        '#title'                         => $this->t('Tags'),
//        '#default_value'                 => $item->getTags() ? implode(', ', $item->getTags()) : '',
		'#default_value'                 => (is_array($item->getTags()) && count($item->getTags())) ? implode(', ', $item->getTags()) : '',
        '#description'                   => $this->t('List of comma-separated tags.'),
        '#required'                      => FALSE,
        '#weight'                        => 41,
        '#autocomplete_route_name'       => 'business_rules.autocomplete_tags',
        '#autocomplete_route_parameters' => [],

      ];

Ah ! I can now use the module !

Thanks

remyyyyy’s picture

Version: 8.x-1.0-beta1 » 8.x-1.0-beta7
Status: Closed (works as designed) » Needs review
colan’s picture

Status: Needs review » Closed (works as designed)

#10: Please see #2997487: Business rules causing commerce add_to_cart_form crash for the Commerce issue, or create another one if you're having a different problem. Thanks.

#11: Please create another issue for that, unless there's one already, as that's a different problem. This issue is closed. Thanks.