2017 © Pedro PelĂĄez
 

typo3-cms-extension seeder

Database seeder for TYPO3

image

tildbj/seeder

Database seeder for TYPO3

  • Monday, April 18, 2016
  • by TildBJ
  • Repository
  • 2 Watchers
  • 3 Stars
  • 960 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 17 Versions
  • 21 % Grown

The README.md

seeder

Build Status Scrutinizer Code Quality Code Coverage Code Intelligence Status, (*1)

Seeder is a TYPO3 Extension that generates fake data for your TYPO3 Extension. Its intended for developers only!!! This Version is an experimental version!, (*2)

Installation

via composer

The recommended way to install seeder is by using composer. 1. Get seeder by running, (*3)

composer require tildbj/seeder
  1. Activate seeder in your Extension Manager

via Extensionmanager:

Faker requires fzaninotto/faker. If you install seeder via Extensionmanager it's up to you to install fzaninotto/faker yourself., (*4)

Usage

Seeder class

Create a class wherever you want. Only make sure it's available via autoloader. Your class should look like this:, (*5)

<?php
namespace TildBJ\Seeder\Seeder;

use TildBJ\Seeder;

class Example extends \TildBJ\Seeder\Seeder\DatabaseSeeder
{
    public function run()
    {
        $this->factory->create('tx_myextension_domain_model_mymodel')->each(function (Seeder\Seed $seed, Seeder\Faker $faker) {
            $seed->set(
                array (
                  'pid' => 1,
                  'sys_language_uid' => 0,
                  'hidden' => 0,
                  'title' => $faker->getTitle(),
                  'description' => $faker->getText(),
                  'relation' => $this->call(\TildBJ\Seeder\Seeder\RelationExample::class),
                  'fal_image' => $this->call(\TildBJ\Seeder\Seeder\Image::class),
                )
            );
        });
    }
}

Add column information to your seed by passing an array to $seed->set([//your columns]). It's mandatory to provide the pid information, otherwise seeder is not able to generate any data., (*6)

Create Seed via commandline:

It's also possible to create a class via cli. Just execute the following command:, (*7)

/path/to/typo3/cli_dispatch.phpsh extbase seeder:make --class-name=Example --table-name=tx_myextension_domain_model_mymodel

Attention: This command creates a seed within the directory Classes/Seeder. It's recommended to move this class outside this extensions otherwise it could get lost after an extension update., (*8)

Execute Seed:

/path/to/typo3/cli_dispatch.phpsh extbase seeder:seed \\Vendor\\Seeder\\Seeder\\Example

Alias:

Create an alias in ext_localconf.php ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['seeder']['alias']['myseed'] = \TildBJ\Seeder\Seeder\Example::class;) for running seed like this:, (*9)

/path/to/typo3/cli_dispatch.phpsh extbase seeder:seed myseed

Contributing

Contribution guidelines for this project, (*10)

History

0.3.1 Fix wrong vendorname in ext_emconf.php
0.3.0 * Fixes a Bug with wrong amount of relations * Feature: Possibility to configer the locale * Defined a more unique vendor name
0.2.2 * Possibility to choose between creating new data and get date which is created just now * Bugfix with recursive call
0.2.1 * Images will be created with a more unique filename so we don't have duplicates anymore
0.2.0 * Seeds can now be available in custom namespaces * You can register own provider by extending global array in ext_localconf.php * When generating seeds cli won't ask for a fieldtype for every field * Update 3rd party extension * Several Bugfixes
0.1.4 Don't return empty properties
0.1.3 * Don't override Properties anymore when calling subseeds * Removes a Bug which leads to exponentially seeder calls * Don't instanciate abstract class, if field is called abstract * Add output decorator * Always ask for a pid even if there is no TCA configuration
0.1.2 Add TYPO3 8.7 support
0.1.1 Skip start and enddate because usually we don't want to test a typo3 core feature so each record will be available in frontend
0.1.0 First experimental release

Troubleshooting

Seeder does not create any data. What am i doing wrong?, (*11)

  • Make sure your seed has a pid that exists in your TYPO3 installation. Otherwise the extension is not able to generate any data.
  • Checkout the Logmodule in the TYPO3 backend if there is any SQL error. It can help a lot to detect wrong configuration of your seed.

Need Support?

Feel free to ask your questions on Slack, (*12)

License

Seeder is released under GNU General Public License, version 3 or later. See the bundled LICENSE file for details., (*13)

The Versions

18/04 2016

dev-extend-test

dev-extend-test http://seeder.roemmich.eu

Database seeder for TYPO3

  Sources   Download

GNU

The Requires

 

The Development Requires

seeding dummy data test data database seeder

18/04 2016

0.1.0

0.1.0.0 http://seeder.roemmich.eu

Database seeder for TYPO3

  Sources   Download

GNU

The Requires

 

The Development Requires

seeding dummy data test data database seeder

18/04 2016

0.1.1

0.1.1.0 http://seeder.roemmich.eu

Database seeder for TYPO3

  Sources   Download

GNU

The Requires

 

The Development Requires

seeding dummy data test data database seeder