Skip to content

Commit

Permalink
fix parent call
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoala committed May 26, 2021
1 parent ee41417 commit 5f3f873
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions code/ValidationLogicCriteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function __construct(FormField $slave, $master, $parent = null)
/**
* Wildcard method for applying all the possible conditions
*
* @link https://github.com/unclecheese/silverstripe-display-logic/blob/c5f807dc24765438b427814350cc884ca70498b0/src/Criteria.php#L100
* @param string $method The method name
* @param array $args The arguments
* @return ValidationLogicCriteria
Expand All @@ -88,8 +89,11 @@ public function __call($method, $args)
$this->addCriterion(ValidationLogicCriterion::create($this->master, $operator, $val, $this));
return $this;
}
if (get_parent_class($this)) {
return parent::__call($method, $args);
if (method_exists($this, $method)) {
return $this->$method(...$args);
}
if ($this->parent && method_exists($this->parent, $method)) {
return $this->parent->$method(...$args);
}
}

Expand Down

2 comments on commit 5f3f873

@bitwingsde
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you create a tag for this?
The module is not php 8 compatible otherwise.

@lekoala
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

Please sign in to comment.