hautelook/AliceBundle — pull request #33 by ddeboer (2014-10-14 09:54:36+00:00)
Title: Return references from load()

Currently, it’s impossible to retrieve persisted objects by their reference name in tests. This PR returns the references (YAML keys) from the `load()` method, so one can use AliceBundle with [DoctrineDataFixtures’ `SharedFixtureInterface`](http://symfony.com/doc/2.0/bundles/DoctrineFixturesBundle/index.html#sharing-objects-between-fixtures):

```php
class LoadDevData extends DataFixtureLoader implements SharedFixtureInterface
{
private $referenceRepository;

public function load(ObjectManager $manager)
{
$references = parent::load($manager);
foreach ($references as $name => $object) {
$this->referenceRepository->add($name, $object);
}
}

public function setReferenceRepository(ReferenceRepository $referenceRepository)
{
$this->referenceRepository = $referenceRepository;
}
}
```

And then in a test:

```php
$referenceRepository->get('some_yaml_key');
```

Additionally, I could add a `Loader::getReferences()`. What do you think?