Coder Social home page Coder Social logo

Comments (8)

h4cc avatar h4cc commented on May 27, 2024

Please check out this branch where i tried to solve that issue: https://github.com/h4cc/AliceFixturesBundle/tree/bug/30-command-reference

You can test it via composer "h4cc/alice-fixtures-bundle": "dev-bug/30-command-reference"

from alicefixturesbundle.

reypm avatar reypm commented on May 27, 2024

@h4cc no, it didn't works I got the same error

from alicefixturesbundle.

h4cc avatar h4cc commented on May 27, 2024

@paquitodev Please check out the README for that case: https://github.com/h4cc/AliceFixturesBundle/tree/bug/30-command-reference#fixturesets-from-different-bundles

from alicefixturesbundle.

reypm avatar reypm commented on May 27, 2024

@h4cc I have rearranged the order of the bundles in the AppKernel.php but I still have some doubts. When you said this in docs:

All FixtureSets will use a global state of references. This way the MyUserBundle can use
entities from MyCommonBundle.

You mean I should setup this parameters:

$set = new h4cc\AliceFixturesBundle\Fixtures\FixtureSet(array(
    'locale' => 'es_ES',
    'seed' => 42,
    'do_drop' => true,
    'do_persist' => true
 ));

At config_dev.yml? If so then this is what you said, right?

h4cc_alice_fixtures:
    locale: es_ES                               # default
    seed: 42                                    # default
    do_flush: true                              # default
    do_drop: true            

    schema_tool: null                           # default
    doctrine: orm                               # default

And a second one, how I run all sets if they are defined in different files? Example:

ComunSet.php lives under ComunBundle
UsuarioSet.php lives under UsuarioBundle

Or the idea here is to have all in one set regardless where fixtures are?

from alicefixturesbundle.

h4cc avatar h4cc commented on May 27, 2024

@paquitodev The a global state of references means, that when running the load:sets Command, all then processed fixture sets will share their references.

The values in config*.yml are just default values, used when FixtureSet do not provide them. There is no need to define them everywhere.

When running load:sets it is intended to look in the default path in all bundles. It is still possible to only create one single Set if you find that easier to use.

from alicefixturesbundle.

reypm avatar reypm commented on May 27, 2024

@h4cc this is weird, I have different sets as I said before one living in ComunBundle and the other at UsuarioBundle and when I ran the command h4cc_alice_fixtures:load:sets I got No sets to load ummm suspicious. In the other side this is how I'm defining my sets:

$set = new h4cc\AliceFixturesBundle\Fixtures\FixtureSet(array(
    'locale' => 'es_VE',
    'seed' => 42,
    'do_drop' => true,
    'do_persist' => true
        ));

$set->addFile(__DIR__ . '/BancoCredito.yml', 'yaml');
$set->addFile(__DIR__ . '/Ciiu.yml', 'yaml');
$set->addFile(__DIR__ . '/CodigoArancelario.yml', 'yaml');
$set->addFile(__DIR__ . '/Pais.yml', 'yaml');
$set->addFile(__DIR__ . '/Estado.yml', 'yaml');
$set->addFile(__DIR__ . '/Municipio.yml', 'yaml');
$set->addFile(__DIR__ . '/Ciudad.yml', 'yaml');
$set->addFile(__DIR__ . '/Parroquia.yml', 'yaml');
$set->addFile(__DIR__ . '/CondicionProducto.yml', 'yaml');
$set->addFile(__DIR__ . '/ComiteTecnico.yml', 'yaml');
$set->addFile(__DIR__ . '/EstadoSolicitud.yml', 'yaml');
$set->addFile(__DIR__ . '/FinalidadProducto.yml', 'yaml');
$set->addFile(__DIR__ . '/OficinaRegional.yml', 'yaml');
$set->addFile(__DIR__ . '/ProcedenciaProducto.yml', 'yaml');
$set->addFile(__DIR__ . '/TipoEmpresa.yml', 'yaml');
$set->addFile(__DIR__ . '/TipoRecaudo.yml', 'yaml');
$set->addFile(__DIR__ . '/TipoRegistro.yml', 'yaml');
$set->addFile(__DIR__ . '/TipoServicio.yml', 'yaml');
$set->addFile(__DIR__ . '/TipoTramite.yml', 'yaml');
$set->addFile(__DIR__ . '/TipoUsuario.yml', 'yaml');

return $set;

Do I need to take care around order? I mean if I have a relationship where, lets say, CondicionProducto and TipoTramite are involve, then I need to load this two first and after the fixture for the relationship or not? How entities order works here?

And yes I can just make a single Set but I'll like to keep them separately since it's better as far as regards organization this unless it's mandatory to have all the fixtures in only one set (I do not think so according to the documentation)

from alicefixturesbundle.

h4cc avatar h4cc commented on May 27, 2024

Do I need to take care around order?

Every file in your Set will be loaded on its own, sequentially: https://github.com/h4cc/AliceFixturesBundle/blob/bug/30-command-reference/Fixtures/FixtureManager.php#L142

I think you need to order them for internal references to work. .. or your simply concatenate the content of all files to a single one and give it to to the FixtureSet.

from alicefixturesbundle.

h4cc avatar h4cc commented on May 27, 2024

Thanks for your contribution @paquitodev, there will be some changes:

  • The commands for loading files or sets will share the references between all loaded fixtures.
  • The ORM Detach has also to be removed for this to work, seemed to be unnecessary anyway.
  • The Yaml Fixture files still have to be consistent on file basis. Like if a.yml references b.yml and back, its not going to work.

from alicefixturesbundle.

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.