Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yaml files location #4

Open
dinamic opened this issue Nov 27, 2014 · 4 comments
Open

Yaml files location #4

dinamic opened this issue Nov 27, 2014 · 4 comments

Comments

@dinamic
Copy link

dinamic commented Nov 27, 2014

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.

@h4cc
Copy link
Owner

h4cc commented Nov 27, 2014

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 h4cc closed this as completed Nov 27, 2014
@dinamic
Copy link
Author

dinamic commented Nov 27, 2014

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.

@h4cc
Copy link
Owner

h4cc commented Nov 28, 2014

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 h4cc reopened this Nov 28, 2014
@dinamic
Copy link
Author

dinamic commented Nov 28, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants