Skip to content

Tags fixtures with doctrine.fixture.orm. #724

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

Closed
wants to merge 2 commits into from
Closed

Tags fixtures with doctrine.fixture.orm. #724

wants to merge 2 commits into from

Conversation

phpeek
Copy link
Contributor

@phpeek phpeek commented Dec 5, 2017

^3.0 releases of DoctrineFixturesBundle treats services as fixtures when they're tagged with doctrine.orm.fixture.

Not sure if this is the most optimal way to do it.

Before:

php bin/console doctrine:fixtures:load -n

In LoadDataFixturesDoctrineCommand.php line 95:
                                                
  Could not find any fixture services to load.                                    

After:

php bin/console doctrine:fixtures:load -n  
  > purging database
  > loading App\DataFixtures\UserFixtures
  > loading App\DataFixtures\TagFixtures
  > loading App\DataFixtures\PostFixtures

@phpeek
Copy link
Contributor Author

phpeek commented Dec 5, 2017

Closing since this is fixed in scope of - #725

@phpeek phpeek closed this Dec 5, 2017
@phpeek phpeek deleted the tagging-doctrine-fixtures branch December 5, 2017 13:36
javiereguiluz added a commit that referenced this pull request Dec 11, 2017
This PR was squashed before being merged into the master branch (closes #727).

Discussion
----------

Revamped the data fixtures

After #724 and #725 I realized that our fixtures are not following the modern best practices recommended by DoctrineFixturesBundle ([explained here](https://symfony.com/doc/master/bundles/DoctrineFixturesBundle/index.html)):

* Use 1 class to load all fixtures unless you have lots of fixtures.
* Make the fixture class extend from Symfony's `Fixture` class instead of the complicated Doctrine's classes.
* Inject services in the constructor and rely on autowiring.
* etc.

Commits
-------

adb76fc Revamped the data fixtures
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

Successfully merging this pull request may close these issues.

1 participant