Code Monkey home page Code Monkey logo

Comments (8)

stof avatar stof commented on August 15, 2024

your class name let me think that you are using Symfony2. In this case, you should use https://github.com/symfony/DoctrineFixturesBundle which autoloads the fixtures (in MyBundle\DataFixtures\ORM) and integrates the command in the Symfony2 CLI.

from data-fixtures.

sliver avatar sliver commented on August 15, 2024

I'm using LiipFunctionalTestBundle to load fixtures for functional test. And, it uses DoctrineFixturesBundle to load fixtures.
I found it will throw exception when a fixture return by getDependencies() but not add by addFixtures().

My suggestion is why not just add dependent fixtures automatically. For example, when we use apt-get to install package, the dependent packages will also install automatically.

Thanks for your reply in advance.

from data-fixtures.

stof avatar stof commented on August 15, 2024

the bundles adds fixtures automatically when you put them in the good namespace: MyBundle\DataFixtures\ORM (note it is DataFixtures, not Fixtures).
And adding fixtures automatically when they appear in the dependencies can cause some issues: what if the fixture class needs some arguments ?

from data-fixtures.

sliver avatar sliver commented on August 15, 2024

Maybe you are right. Don't you think that the exception message should be Fixture "MyBundle\DataFixtures\ORM\LoadUserData" was declared as a dependency, but it should be added in fixture loader first. ?

from data-fixtures.

stof avatar stof commented on August 15, 2024

yeah, the exception message can probably be improved

from data-fixtures.

guilhermeblanco avatar guilhermeblanco commented on August 15, 2024

@sliver please make a PR for this exception update. =)

from data-fixtures.

sliver avatar sliver commented on August 15, 2024

Improve exception message #32.

@stof I don't have idea why fixture class needs some arguments.
Since the exception message got improved, I think it's good enough.

from data-fixtures.

stof avatar stof commented on August 15, 2024

@sliver to inject some dependencies of the class.

And for instance, in the Symfony bundle, an extended loader is used to allow injecting the container in the class if the fixture class implement the needed interface. Someone using a different way to handle the dependencies could choose to use arguments when registering the fixtures in the loader

from data-fixtures.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.