Skip to content

Commit

Permalink
Adding a warning about using the parameter based syntax for resource …
Browse files Browse the repository at this point in the history
…classes
  • Loading branch information
mamazu committed Oct 27, 2022
1 parent 46371c4 commit 9067e27
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ClassConfigConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ public function handleGrid(string $gridName, array $gridConfiguration): array

$resourceClass = $gridConfiguration['driver']['options']['class'] ?? 'To be replaced with the correct class.';

if (strpos($resourceClass, '%') !== false || strpos($resourceClass, 'expr:param') !== false) {
trigger_error('You are using the parameter based syntax which does not work. Either provide a class directly in the getResourceClass or pass it by the constructor.', E_USER_WARNING);
}

if (!$this->functional) {
$className = ucfirst(preg_replace_callback('#_\w#', static fn($a) => strtoupper($a[0][1]), $gridName));
$phpNodes[] = new Class_(
Expand Down

0 comments on commit 9067e27

Please sign in to comment.