Skip to content

Commit

Permalink
Fix outdated documentation regarding References Handling (#786)
Browse files Browse the repository at this point in the history
Fix #785.
  • Loading branch information
theofidry authored Sep 12, 2017
1 parent b054822 commit 5c9e801
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions doc/relations-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ To be able to use this feature, your entities have to match some requirements :
`@name->property` will call `$name->getProperty()` if ```property``` is not
public)
* You can reference private properties [by decorating the property accessor with the `ReflectionPropertyAccessor`](advanced-guide.md#custom-accessor)
* You can reference entities' ID but you will then have to split fixtures in
multiple files (this is because objects are persisted at the end of each file
processing) :
* You can reference entities' ID :

```yaml
# fixture_user.yml
Expand All @@ -67,6 +65,9 @@ Nelmio\Entity\Group:
owner: '@user1->id'
```

**Warning:** If you are using IDs this way, this either means you are setting the IDs when your object is created like
with UUIDs or you will not have any guarantee the ID is not already used in the database.

If you want to create ten users and ten groups and have each user own one
group, you can use `<current()>` which is replaced with the current ID of
each iteration when using fixture ranges:
Expand Down

0 comments on commit 5c9e801

Please sign in to comment.