Dear developper

I would like to know if the tuto located at https://www.drupal.org/docs/8/modules/business-rules/advanced-usage/depe... is right?

Following this with attention, I have the following error message when I want to add an article :

InvalidArgumentException: Field is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 509 of core\lib\Drupal\Core\Entity\ContentEntityBase.php)

Could you check?

Regards
Etienne

Comments

cocq created an issue. See original summary.

cocq’s picture

Issue summary: View changes
d.novikov’s picture

There are 2 issues with the module:

  • Error messages due to missing handler_settings index
  • Ability to work with only one field on the entity edit form

Attaching the patch that hopefully fixes both ones. Please check!

mrsmile’s picture

d.novikov,
could you please explain me how can I apply the patch?
Currently I have the similiar issue
thanks

mrsmile’s picture

StatusFileSize
new188.12 KB

Hi guys!
I tested this attached patch and I can say that it works (for first look)
you can find patched module in attach
thanks to d.novikov

socialnicheguru’s picture

Status: Active » Needs review

git apply (patch name)

socialnicheguru’s picture

Status: Needs review » Needs work

The patch addresses the initial issue.
It allows the code to continue to a new error below.

1. Create a rule
2. Create a condition. This case the condition is comparing a field in an entity.
I saved the condition without completing it
3. I added the condition to the rule I created

I then get the error below.
there is a comparison at line 158 in business_rules/src/Plugin/BusinessRulesCondition/DataComparison.php:

 if ($data_to_compare == self::CURRENT_DATA) {
      $entity = $event->getArgument('entity');
    }
    elseif ($data_to_compare == self::ORIGINAL_DATA) {
      $entity = $event->getArgument('entity_original');
    }

there should be an option if "$date_to_compare" is NULL or empty. IE someone has not finished the rule.

I found that the field that I was using was defined but the data_to_compare was not.
field = field_my_address
data to compate =

When I saved content or did 'drush cr' I get:

Error: Call to a member function get() on null in drupal-8.4.4/html/modules/download/business_rules/src/Plugin/BusinessRulesCondition/DataComparison.php on line 164
#0 drupal-8.4.4/html/modules/download/business_rules/src/Entity/Condition.php(225): Drupal\business_rules\Plugin\BusinessRulesCondition\DataComparison->process(Object(Drupal\business_rules\Entity\Condition), Object(Drupal\business_rules\Events\BusinessRulesEvent))

joao sausen’s picture

Using this patch in a project and I can confirm that it works.

dan_metille’s picture

For me, patch #3 helps fixing the module, but I'm indeed still unable to work with more than one field on the entity edit form. (I'm using the dev version).

Any help would be welcome.

yseki’s picture

Assigned: Unassigned » yseki
Status: Needs work » Fixed

Fixed on version alpha11.

PluginBase in Drupal 8.5 does not bring the value of configuration['handler_settings'] as in previous version.

dan_metille’s picture

Did not worked on alpha15. Switched to dev version with patch #3.

dan_metille’s picture

Status: Fixed » Active

  • yuriseki committed 566d05e on 8.x-1.x authored by d.novikov
    Issue #2929219 by d.novikov, mrsmile, sahaj, cocq, SocialNicheGuru, Joao...
yseki’s picture

Status: Active » Fixed

I've made some mistake with GIT.
It's fixed on DEV now.

Thanks

tudxndvn’s picture

Hi @yuriseki : I am trying create node Job with taxonomy: State and City. I folllowed : https://www.drupal.org/docs/8/modules/business-rules/advanced-usage/depe.... I work all step of it and it show state normal. But I don't know config Business Rules for change list value City when changed state . Can you tell me how to config Business Rules about: Rule , Action, Condititon.. My skype : batngodaisu. You can add my skype or reply me in this thread. Thank you

Status: Fixed » Closed (fixed)

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

lule75’s picture

I am trying to add an action to a condition but this is what i get.. I am using https://www.drupal.org/project/business_rules/releases/8.x-1.0-beta1

Fatal error: Call to a member function toString() on null in C:\xampp\htdocs\...\modules\business_rules\src\Form\ConditionForm.php on line 228

please help.. thank you in advance

tudxndvn’s picture

cool, it work for me. Thank @yuriseki. But i have a new question. I have 3 taxonomy : location, sub-region and region. When i update value of location , i want to fill automatic value of region and sub-region . Can we use Business Rules for this case. Thank you. Cheers!