PHP code example of tildbj / seeder

1. Go to this page and download the library: Download tildbj/seeder 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/ */

    

tildbj / seeder example snippets



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),
                )
            );
        });
    }
}
 ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['seeder']['alias']['myseed'] = \TildBJ\Seeder\Seeder\Example::class;)