nelmio/alice — pull request #13 by jubianchi (2012-12-04 13:17:14+00:00)
Title: Allow property referencing inside fixtures

This pull request adds the ability to reference entities' properties inside fixtures :

Usage : ```fixture.yml```

```yml
Vendor\Bundle\Entity\Fake:
fake1:
name: 'Foo'
type: 'bar'

Vendor\Bundle\Entity\AnotherFake:
fake2:
name: 'Foo'
type: @fake1.type
```

There is a major drawback to me with this PR : if you want to reference an entity ID, you have to split the fixtures in multiples files because the objects are persisted at the end of the loading process of each file and then the loading order becomes important :

```fixture_first.yml``` :
```yml
Vendor\Bundle\Entity\Fake:
fake1:
name: 'Foo'
type: 'bar'
```

```fixture_second.yml``` :
```yml
Vendor\Bundle\Entity\AnotherFake:
fake2:
name: 'Foo'
options:
refs: @fake1.id
```

I had to use this in a case similar to the example above where an entity's ID is referenced inside a serialized array (stored as a string in the database)