AliceDemo icon indicating copy to clipboard operation
AliceDemo copied to clipboard

Yaml files location

Open dinamic opened this issue 11 years ago • 4 comments

Today I had an argument with a senior developer from our team whether the yml files used in Alice should be into src/AcmeBundle/DataFixtures/ORM or src/AcmeBundle/Resources/fixtures.

The former was my proposal as I've seen this approach in some other projects. However, I lost the argument and this demo bundle was pointed to me as example to follow.

I think this is the wrong location to put the yml files, because there should be some level of separation. In general the Resources/ folder should be considered when putting non-php files into the project.

Can you give me some comments on that and move the yml files probably? Thanks.

dinamic avatar Nov 27 '14 20:11 dinamic

Thanks for that request. This repo is for demonstration purposes, so i created a issue in the AliceFixtureBundle Repo and will be closing this issue then.

h4cc avatar Nov 27 '14 23:11 h4cc

Probably you did not really got my request. It is in fact for the demonstration bundle.

Instead of doing:

$set->addFile(__DIR__.'/users.yml', 'yaml');

It could probably do:

$fileLocator = $container->get('file_locator');
$path = $fileLocator->locate('@MyBundle/Resources/fixtures/users.yml');
$set->addFile($path, 'yaml');

The sole purpose of this is to have a nice example with yml files being treated as resources.

dinamic avatar Nov 27 '14 23:11 dinamic

Ah, i get it. As i can see from your example, a file_locator might be usefull in a FixtureSet, but that will need some DependencyInjection changes because currently there is no DI available for FixtureSets.

@dinamic Do you think it would good for FixtureSets to be ContainerAware or maybe we create something like FileLocatorAware?

h4cc avatar Nov 28 '14 08:11 h4cc

It will be better to be aware only of the FileLocatorInterface. Having the whole container on your disposal is never a good thing.

dinamic avatar Nov 28 '14 17:11 dinamic