Skip to content

Commit

Permalink
Add doc to explain how to access nested property from relation.
Browse files Browse the repository at this point in the history
I thinks the right syntaxe must be something like `@self->created_by->info->created`, but like said it nelmio#1116 and refered in nelmio#1019, it does not work for now. Using this syntax `@self->created_by.info.created`, it works.
  • Loading branch information
Benjamin Georgeault committed Feb 8, 2023
1 parent 048e4fb commit bdd44c8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions doc/fixtures-refactoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,23 @@ Nelmio\Entity\Group:
As you can see, we make sure that the update date is between the creation
date and the current time, which ensure the data will look real enough.

If you need to access a property from another object that is a property of your current object, you can do as following:

```yaml
Nelmio\Entity\User:
user1:
# ...
created: '<dateTimeBetween("-200 days", "now")>'
Nelmio\Entity\Group:
group1:
# ...
created_by: '@user1'
created: '<dateTimeBetween(@self->created_by.created, "now")>'
updated: '<dateTimeBetween($created, "now")>'
```

You can also multi depth with more `.` like `@self->created_by.info.created`.

## Parameters

Expand Down

0 comments on commit bdd44c8

Please sign in to comment.