PHP Classes

How to Use a PHP Fixtures Generator Package to Yii2 Fixture ii: Generate fixture code files from templates scripts

Recommend this page to a friend!
  Info   View files Example   View files View files (36)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-04-22 (15 hours ago) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
yii2-fixturegii 1.0MIT/X Consortium ...5Databases, Libraries, Code Generation, C...
Description 

Author

This package can Generate fixture code files from templates scripts.

It provides several types of classes that extend the Yii2 framework generator class to generate files of different types.

Currently, it can generate fixture code files from database tables as:

- Classes

- Global code scripts

- Configuration code scripts using returned arrays

Picture of Insolita
  Performance   Level  
Name: Insolita <contact>
Classes: 22 packages by
Country: Russian Federation Russian Federation
Innovation award
Innovation award
Nominee: 15x

Example

#!/usr/bin/env php
<?php
require(__DIR__ . '/bootstrap.php');
$config = require(__DIR__ . '/config/app.php');
$app = new yii\console\Application($config);
$exitCode = $app->run();
exit(
$exitCode);


Details

Yii2-fixture/template-generator

Status Latest Stable Version Total Downloads License

Gii fixture helper - generate fixture classes; faker templates; fixture data files from table support bulk template and data-file generations

Installation

composer require --dev --prefer-dist insolita/yii2-fixturegii "~3.0.0"

or add

"insolita/yii2-fixturegii": "~3.0.0"

to the require-dev section of your composer.json file.

Usage

Register insolita\fixturegii\Bootstrap in bootstrap section of backend application, or add needed generators in section of gii module

Go to gii and use new Generators

Suggest:

define '@test' or '@fixture' alias for quick path setup

Customize

Set up in gii config sections

  $config['modules']['gii'] = [
          'class' => 'yii\gii\Module',
          'generators' => [
              //...
              'fixtureClass'=>[
                  'class'=>\insolita\fixturegii\generators\ClassGenerator::class,
                  'templates'=>[
                           //add your custom
                  ]
              ],
              'fixtureData'=>[
                  'class'=>\insolita\fixturegii\generators\DataGenerator::class,
                  'tableResolverClass'=>'You can set own implementation',
                  'templates'=>[
                        //add your custom
                  ]
              ],
              'fixtureTemplate'=>[
              'class'=>\insolita\fixturegii\generators\TemplateGenerator::class,
                'tableResolverClass'=>'You can set own implementation',
                'columnResolverClass'=>'You can set own implementation',
                'templates'=>[
                        //add your custom
                ]
              ],
          ]
          //...
      ];


  Files folder image Files  
File Role Description
Files folder imagesrc (1 file, 6 directories)
Files folder imagetests (3 files, 4 directories)
Accessible without login Plain text file .dockerignore Data Auxiliary data
Accessible without login Plain text file .php_cs.dist Example Example script
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file codeception.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file docker-compose.yml Data Auxiliary data
Accessible without login Plain text file Makefile Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imagecontracts (2 files)
Files folder imageforms (3 files)
Files folder imagegenerators (3 files)
Files folder imageobjects (2 files)
Files folder imageservices (2 files)
Files folder imagetemplates (3 files)
  Plain text file Bootstrap.php Class Class source

  Files folder image Files  /  src  /  contracts  
File Role Description
  Plain text file IFakerColumnResolver.php Class Class source
  Plain text file ITableResolver.php Class Class source

  Files folder image Files  /  src  /  forms  
File Role Description
  Accessible without login Plain text file class_form.php Example Example script
  Accessible without login Plain text file data_form.php Example Example script
  Accessible without login Plain text file template_form.php Example Example script

  Files folder image Files  /  src  /  generators  
File Role Description
  Plain text file ClassGenerator.php Class Class source
  Plain text file DataGenerator.php Class Class source
  Plain text file TemplateGenerator.php Class Class source

  Files folder image Files  /  src  /  objects  
File Role Description
  Plain text file TableIndex.php Class Class source
  Plain text file TableRelation.php Class Class source

  Files folder image Files  /  src  /  services  
File Role Description
  Plain text file FakerColumnResolver.php Class Class source
  Plain text file TableResolver.php Class Class source

  Files folder image Files  /  src  /  templates  
File Role Description
  Accessible without login Plain text file fixture_class.php Example Example script
  Accessible without login Plain text file fixture_data.php Aux. Auxiliary script
  Accessible without login Plain text file fixture_tpl.php Aux. Auxiliary script

  Files folder image Files  /  tests  
File Role Description
Files folder imageconfig (1 file)
Files folder imagehelpers (1 file, 1 directory)
Files folder imagemigrations (2 directories)
Files folder imageunit (4 files)
  Accessible without login Plain text file bootstrap.php Aux. Auxiliary script
  Accessible without login Plain text file unit.suite.yml Data Auxiliary data
  Accessible without login Plain text file yii Example Example script

  Files folder image Files  /  tests  /  config  
File Role Description
  Plain text file app.php Class Class source

  Files folder image Files  /  tests  /  helpers  
File Role Description
Files folder image_generated (1 file)
  Plain text file UnitTester.php Class Class source

  Files folder image Files  /  tests  /  helpers  /  _generated  
File Role Description
  Plain text file UnitTesterActions.php Class Class source

  Files folder image Files  /  tests  /  migrations  
File Role Description
Files folder imagemysql (1 file)
Files folder imagepg (1 file)

  Files folder image Files  /  tests  /  migrations  /  mysql  
File Role Description
  Plain text file m170428_223742_mysqltest_migration.php Class Class source

  Files folder image Files  /  tests  /  migrations  /  pg  
File Role Description
  Plain text file m170428_223742_pgtest_migration.php Class Class source

  Files folder image Files  /  tests  /  unit  
File Role Description
  Accessible without login Plain text file bootstrap.php Aux. Auxiliary script
  Plain text file FakerColumnResolverTest.php Class Class source
  Plain text file TableResolverMysqlTest.php Class Class source
  Plain text file TableResolverPgTest.php Class Class source

 Version Control Unique User Downloads  
 100%
Total:0
This week:0