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

Support custom rule classes in @rules and @rulesForArray #812

Merged
merged 15 commits into from
May 26, 2019
7 changes: 7 additions & 0 deletions src/Schema/Directives/RulesDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ public function getRules(): array
{
$rules = $this->directiveArgValue('apply');

// Resolve custom rule namespace, if possible.
foreach ($rules as $key => $rule) {
if (strpos($rule, 'App\Rules') === 0) {
spawnia marked this conversation as resolved.
Show resolved Hide resolved
$rules[$key] = resolve($rule);
}
}

return [$this->argumentPathAsDotNotation() => $rules];
}

Expand Down