You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which is a qlv_ prefix followed by a random 18 characters string. The best way I found to get this done (if anyone knows another one or a better way to get this done let me know) was using a custom faker and I wrote this piece of code:
<?php
/**
* FakerProvider: VeevaProvider.
*/
namespace PDI\PDOneBundle\DataFixtures;
use ReverseRegex\Lexer;
use ReverseRegex\Random\SimpleRandom;
use ReverseRegex\Parser;
use ReverseRegex\Generator\Scope;
class VeevaProvider extends \Faker\Provider\Base
{
public function veevaRepId()
{
$lexer = new Lexer('[a-zA-Z0-9]{18}');
$gen = new SimpleRandom(10007);
$result = '';
$parser = new Parser($lexer, new Scope(), new Scope());
$parser->parse()->getResult()->generate($result, $gen);
return 'qlv_' . $result;
}
}
As explain here in Faker docs. Now, here at NelmioAlice the author explain how to add Custom Faker Data Providers but it uses Doctrine Fixtures which I don't so, having this, how do I load and use the provider I wrote on the fixtures? Any advice around this? How the custom provider should be added and used on this bundle?
The text was updated successfully, but these errors were encountered:
Using custom FakerProvider is the way to generate domain-specific data like you have there.
But i cant see, why the Provider has to extend \Faker\Provider\Base, because it does not use anything of that class.
I am setting up NelmioAlice and Faker in a Symfony2 project through AlixeFixturesBundle. I need a composed fixture like for example:
which is a
qlv_
prefix followed by a random 18 characters string. The best way I found to get this done (if anyone knows another one or a better way to get this done let me know) was using a custom faker and I wrote this piece of code:As explain here in Faker docs. Now, here at NelmioAlice the author explain how to add Custom Faker Data Providers but it uses Doctrine Fixtures which I don't so, having this, how do I load and use the provider I wrote on the fixtures? Any advice around this? How the custom provider should be added and used on this bundle?
The text was updated successfully, but these errors were encountered: