Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 24 2019 16:38
    theofidry commented #112
  • Jan 24 2019 16:28
    benji07 commented #112
  • Dec 28 2018 08:25
    jdeniau commented #113
  • Dec 27 2018 13:03
    jdeniau opened #113
  • Dec 05 2018 15:27
    theofidry commented #112
  • Dec 05 2018 15:27

    theofidry on master

    Fixed root_node deprecation wit… (compare)

  • Dec 05 2018 15:27
    theofidry closed #112
  • Dec 05 2018 11:41
    jmsche opened #112
  • Nov 22 2018 10:00
    romainnorberg commented #48
  • Nov 15 2018 17:59
    yakobe commented #105
  • Nov 15 2018 17:57
    yakobe commented #105
  • Nov 15 2018 10:17
    theofidry commented #105
  • Nov 15 2018 10:03
    yakobe commented #105
  • Nov 15 2018 07:54
    theofidry commented #105
  • Nov 15 2018 07:50
    yakobe commented #105
  • Nov 14 2018 16:52
    Toflar commented #110
  • Nov 14 2018 16:43
    Toflar opened #111
  • Nov 14 2018 16:18
    Toflar edited #110
  • Nov 14 2018 16:18
    Toflar opened #110
  • Nov 14 2018 14:21
    Toflar commented #68
Adam
@aciezkowski
nvm, I can see they are updating packagist urls
on the go
Théo FIDRY
@theofidry
na it's ok, there is some local copy here and there, most of the tagged version are being pushed back on the backup orga
obviously non-tagged versions are more problematic though
Adam
@aciezkowski
ok cheers mate
thanks for explaning
Théo FIDRY
@theofidry
no worries
cross your fingers hoping the orga can be restaured
Adam
@aciezkowski
I do
Théo FIDRY
@theofidry
all back to normal now :)
Vincent D.
@vdebes
Hi there!
I am stuck trying to pass ArrayCollections in a fixture yml. Does someone know how to do that ?
Théo FIDRY
@theofidry
Err what do you mean exactly?
Vincent D.
@vdebes
I have a fixture for users … they all have several roles … irn the user entity, setRoles expect an ArrayCollection, not a regular array
so I get an exception when I try to load fixtures with roles: ['@RoleUser','@RoleAdmin']
  Type error: Argument 1 passed to UserBundle\Entity\User::setRoles() must be an instance of Doctrine\Common\Collections\ArrayCollection, array given,
I cannot find it in the doc nor something on stack'
Théo FIDRY
@theofidry
No it's handled out of the box; as it's more user specific you have to take a look at custom faker providers to eventually take the array you receive and transform it as an ArrayCollection
Sorry I can't give you a link from my phone but it should be easy to find
Vincent D.
@vdebes
ok, I found a page on the doc about custom faker providers.
I now have to figure out how to make it work ;) Thanks for the tips
Théo FIDRY
@theofidry
No worries, it should be rather straightforward :)
Théo FIDRY
@theofidry
Fill an issue on the repo if you can't find a solution, but it should be a matter of having a provider with a method to transform your array into an ArrayCollection
Adam Ouellette
@adamo57
Hi, does anyone know how to make a basic array of strings? using <words($nb = 3, $asText = false)> doesn't appear to be working
Théo FIDRY
@theofidry
<words(3, false)>?
Andrey Novikov
@xaoc-303
Hi, how to use the method getOrder ?
Théo FIDRY
@theofidry
@xaoc-303 wdym?
Andrey Novikov
@xaoc-303
@theofidry the order in which fixtures will be loaded
like this
http://symfony.com/doc/current/bundles/DoctrineFixturesBundle/index.html
Théo FIDRY
@theofidry
You should not use it, the compatibility with DoctrineFixturesBundle has been somewhat kept in 1.x for easing the upgrade path but it is deprecated since day 1. The order in which you load the fixtures should not matter
Andrey Novikov
@xaoc-303
but, if necessary, for example, to load the fixture UserBundle first, second CoreBundle ? What do you advise?
Théo FIDRY
@theofidry
I would ask why does it matter?
Théo FIDRY
@theofidry

The logic of DoctrineFixturesBundle is to have several loaders that creates fixtures, for which the order can matter. In HautelookAliceBundle the approach is different: you create a fixture file for each class, eg:

  • dummy.yml
  • foo.yml
  • bar.yml

Then the loader will try to load them one by one, injecting the result of the loaded file when loading the next one:

  • load dummy.yml
  • try to load foo.yml with the result of dummy.yml
  • load `bar.yml

Then if some files could not be loaded, e.g. here foo.yml because it requires some fixtures from bar.yml, a second pass is done:

  • load foo.yml with the result of dummy.yml and bar.yml

So the loader actually tries to load your files several times before giving up, having the right order might speed up a little bit (a few ms) the loading process but that's all

If you really want to have controller over the order, you should decorate the Finder service used to re-order them the way you want, you cannot rely on anything else: discovering the bundles to load and the files result in a set of files in a random order. Even with the same config on the same machine the result may differ between a load and another
Andrey Novikov
@xaoc-303
@theofidry Thanks.
I have done so.
Changed order bundles into AppKernel.
before:
CoreBundle, MyBundle, UserBundle
after:
CoreBundle, UserBundle, MyBundle
@theofidry about decorate the Finder - has an example?
Théo FIDRY
@theofidry

As you can see here, a call on Finder#getFixtures() is made. So you can create a new finder service decorating the old one, and return the re-ordered fixtures.

An alternative is to decorate the Loader to re-order the fixtures there instead, see https://github.com/hautelook/AliceBundle/blob/1.x/src/Alice/DataFixtures/Loader.php#L73

if it's not clear look up the decorator pattern and how to override services in Symfony
Gerard Brull
@poteirard
Hi, I'm new with AliceBundle

I just installed it and I get the following error:

[26-Jan-2017 12:44:07 Europe/Madrid] PHP Warning:  Cannot open '/etc/browscap.ini' for reading in Unknown on line 0
[26-Jan-2017 12:44:07 Europe/Madrid] PHP Fatal error:  Declaration of FidryAliceDataFixturesLoaderMultiPassLoader_000000004c46ea97000000004b86149d8b35cff2676aa6ed51f4ee74ee980241::load(array $fixturesFiles, array $parameters = Array, array $objects = Array) must be compatible with Fidry\AliceDataFixtures\LoaderInterface::load(array $fixturesFiles, array $parameters = Array, array $objects = Array): array in /var/www/vagrant/trovit.new/kolekti/cache/appDevDebugProjectContainer.php on line 28152

Fatal error: Declaration of FidryAliceDataFixturesLoaderMultiPassLoader_000000004c46ea97000000004b86149d8b35cff2676aa6ed51f4ee74ee980241::load(array $fixturesFiles, array $parameters = Array, array $objects = Array) must be compatible with Fidry\AliceDataFixtures\LoaderInterface::load(array $fixturesFiles, array $parameters = Array, array $objects = Array): array in /var/www/vagrant/trovit.new/kolekti/cache/appDevDebugProjectContainer.php on line 28152

Any clue?

when clearing the cache for example or using the load command
Clem Freeman
@clemf
How do I do an optional reference with a default?
From the docs: D%? X: Y
I’m trying to do 10%? ‘@ref1’: ‘@ref2’
10%? ‘@ref1’ works, but when I try to add a second I can’t get the syntax right (in yaml).
Clem Freeman
@clemf
I can’t use a colon in yaml, does that mean this functionality isn’t supported?
mattxtlm
@mattxtlm
Hi there! Is there a way to created consistent references between tables? See this example: Pastebin Example. thx
mattxtlm
@mattxtlm

Hi guys, I just found a solution myself. I use god old php within the fixtures.

supplierBranch: '@supplierBranch_*'
supplier: '<identity($supplierBranch->getSupplier())>'

Hope, this helps somebody. If there is a better solution, please let me know! cheers

grenoult
@grenoult
Hi,
I have the following question regarding Alice Bundle:
  • Can we generate a random number of records, instead of {1..10} ?
  • Is there a way to call processor methods for a specific set of data?
  • Can we call a method or service at the end of the fixture data generation? A good example is Solr indexing.
  • In UML files, can we call methods from a service or entity?
    Thanks
Théo FIDRY
@theofidry
Hi @grenoult.
  1. No
  2. No, it is applied to all data so if you want to apply it to only one you must do a check to skip it when appropriate. Alternatively in 3.x you can manipulate the return result right away.
  3. Yes you can, via a configurator
  4. Not sure to understand
sorry I'm not very active on Gitter, I recommend you to head to the #alice-fixtures channel of the Symfony-dev Slack instead