PHP code example of mbezhanov / silex-alice-data-fixtures
1. Go to this page and download the library: Download mbezhanov/silex-alice-data-fixtures library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mbezhanov / silex-alice-data-fixtures example snippets
use Bezhanov\Silex\AliceDataFixtures\FixturesServiceProvider;
use Dflydev\Provider\DoctrineOrm\DoctrineOrmServiceProvider;
use Silex\Application;
use Silex\Provider\DoctrineServiceProvider;
use Symfony\Component\Console\Application as Console;
$app = new Application();
$app->register(new DoctrineServiceProvider(), array(
'db.options' => [
'driver' => 'pdo_sqlite',
'path' => __DIR__ . '/sqlite.db',
],
));
$app->register(new DoctrineOrmServiceProvider(), [
'orm.em.options' => [
'mappings' => [
[
'type' => 'annotation',
'namespace' => 'App\Entity',
'path' => __DIR__ . '/src/App/Entity',
'use_simple_annotation_reader' => false,
],
],
],
]);
$console = new Console();
$app->register(new FixturesServiceProvider($console));
$app->boot();
$console->run();
use Bezhanov\Silex\AliceDataFixtures\FixturesServiceProvider;
$app = new Silex\Application();
$faker = Faker\Factory::create();
$faker->addProvider(new Bezhanov\Faker\Provider\Food($faker));
$app->register(new FixturesServiceProvider($console), [
'fixtures.faker_generator' => $faker,
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.