Elgg  Version master
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Elgg\Database\Seeds\Seed Class Reference

Abstract seed. More...

Inheritance diagram for Elgg\Database\Seeds\Seed:
Elgg\Database\Seeds\Seedable Elgg\Database\Seeds\Groups Elgg\Database\Seeds\Users

Public Member Functions

 __construct (array $options=[])
 Seed constructor. More...
 
 getCount ()
 Get the count of the seeded entities. More...
 
 advance (int $step=1)
 Advance progressbar. More...
 
 seed ()
 Populate database. More...
 
 unseed ()
 Removed seeded rows from database. More...
 
- Public Member Functions inherited from Elgg\Database\Seeds\Seedable
 createUser (array $properties=[])
 Create a new fake user. More...
 
 createGroup (array $properties=[])
 Create a new fake group. More...
 
 createObject (array $properties=[])
 Create a new fake object. More...
 
 createSite (array $properties=[])
 Create a new fake site. More...
 

Static Public Member Functions

static register (\Elgg\Event $event)
 Register this class for seeding. More...
 
static getDefaultLimit ()
 Get the default number of content to seed. More...
 
static getType ()
 Get the (un)seeding type of this handler. More...
 

Protected Member Functions

 getCountOptions ()
 Get options for elgg_count_entities() More...
 

Protected Attributes

int $limit
 
bool $create = false
 
int $seeded_counter = 0
 

Detailed Description

Abstract seed.

Plugins should extend this class to create their own seeders, add use 'seeds','database' event to add their seed to the sequence.

Definition at line 14 of file Seed.php.

Constructor & Destructor Documentation

Elgg\Database\Seeds\Seed::__construct ( array  $options = [])

Seed constructor.

Parameters
array$optionsseeding options
  • limit: Number of item to seed
  • create: create new entities (default: false)
  • create_since: lower bound creation time (default: now)
  • create_until: upper bound creation time (default: now)

Definition at line 45 of file Seed.php.

Member Function Documentation

Elgg\Database\Seeds\Seed::advance ( int  $step = 1)

Advance progressbar.

Parameters
int$stepStep
Returns
void

Definition at line 98 of file Seed.php.

Elgg\Database\Seeds\Seed::getCount ( )
final

Get the count of the seeded entities.

Returns
int

Definition at line 78 of file Seed.php.

Elgg\Database\Seeds\Seed::getCountOptions ( )
abstractprotected

Get options for elgg_count_entities()

Returns
array
See also
self::getCount()
static Elgg\Database\Seeds\Seed::getDefaultLimit ( )
static

Get the default number of content to seed.

Returns
int

Definition at line 109 of file Seed.php.

static Elgg\Database\Seeds\Seed::getType ( )
staticabstract

Get the (un)seeding type of this handler.

Returns
string
static Elgg\Database\Seeds\Seed::register ( \Elgg\Event  $event)
staticfinal

Register this class for seeding.

Parameters
\Elgg\Event$event'seeds', 'database'
Returns
array

Definition at line 65 of file Seed.php.

int Max number of items to be created by the Elgg\Database\Seeds\Seed::seed ( )
abstract

Populate database.

Returns
mixed
Elgg\Database\Seeds\Seed::unseed ( )
abstract

Removed seeded rows from database.

Returns
mixed

Member Data Documentation

bool Elgg\Database\Seeds\Seed::$create = false
protected

Definition at line 29 of file Seed.php.

int Elgg\Database\Seeds\Seed::$limit
protected

Definition at line 24 of file Seed.php.

int Elgg\Database\Seeds\Seed::$seeded_counter = 0
protected

Definition at line 34 of file Seed.php.


The documentation for this class was generated from the following file: