Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace in fields ThemeContainer::getValidationRulesEnrichment() usage to method validationRulesEnricher() #344

Closed
vjik opened this issue Jun 28, 2024 · 0 comments · Fixed by #351
Assignees
Labels
status:under development Someone is working on a pull request.

Comments

@vjik
Copy link
Member

vjik commented Jun 28, 2024

Before:

protected function beforeRender(): void
{
	if ($this->enrichFromValidationRules) {
		$this->enrichment = ThemeContainer::getValidationRulesEnrichment($this, $this->getInputData());
	}
}

After:

private ?ValidationRulesEnricherInterface $validationRulesEnricher = null

public function validationRulesEnricher(?ValidationRulesEnricherInterface $enricher): self
{
    $new = clone $this;
    $new->validationRulesEnricher = $enricher;
    return $new;
}

protected function beforeRender(): void
{
	if ($this->enrichFromValidationRules) {
		$this->enrichment = $this->validationRulesEnricher?->process($this, $this->getInputData()->getValidationRules()) ?? [];
	}
}

This is to remove dependency from static ThemeContainer.

@arogachev arogachev self-assigned this Jul 8, 2024
@arogachev arogachev added the status:under development Someone is working on a pull request. label Jul 11, 2024
@arogachev arogachev added this to the 1.0 milestone Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:under development Someone is working on a pull request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants