Skip to content

Commit

Permalink
Add new annotation property target to contain fully qualified class n…
Browse files Browse the repository at this point in the history
…ame of object that property stores or method returns
  • Loading branch information
kifril committed Nov 14, 2022
1 parent 3f5df8b commit 84ad252
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Annotation/Sandbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@ class Sandbox
* List of allowed types is defined in `intaro.twig_sandbox.sandbox_annotation.value_types` parameter
*/
public $type = 'string';

/**
* Fully qualified class name of object that property stores or method returns
*
*/
public $target = '';
}
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ $ composer require intaro/twig-sandbox-bundle
## Usage

Define allowed properties and methods for your entities using annotation `@Sandbox`.
Optionally you can add `type` option for annotation.
This option defines type of value that property stores or method returns.
Optional attributes:
* `type`: This option defines type of value that property stores or method returns
* `target`: This option defines fully qualified class name of object that property stores or method returns

In your application you can use annotation reader to extract value of `type` option and use this value
In your application you can use annotation reader to extract values of options and use this values
to perform additional checks or any other actions, for example, use twig filters according to value of the option.

```php
Expand Down

0 comments on commit 84ad252

Please sign in to comment.