Elgg  Version 4.x
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 $attributes=[], array $metadata=[])
 Create a new fake user. More...
 
 createGroup (array $attributes=[], array $metadata=[])
 Create a new fake group. More...
 
 createObject (array $attributes=[], array $metadata=[])
 Create a new fake object. More...
 
 createSite (array $attributes=[], array $metadata=[])
 Create a new fake site. More...
 

Static Public Member Functions

static register (\Elgg\Hook $hook)
 Register this class for seeding. 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

 $limit = 20
 
 $create = false
 
 $seeded_counter = 0
 

Detailed Description

Abstract seed.

Plugins should extend this class to create their own seeders, add use 'seeds','database' plugin hook 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 96 of file Seed.php.

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

Get the count of the seeded entities.

Returns
int

Definition at line 76 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::getType ( )
staticabstract

Get the (un)seeding type of this handler.

Returns
string
static Elgg\Database\Seeds\Seed::register ( \Elgg\Hook  $hook)
staticfinal

Register this class for seeding.

Parameters
\Elgg\Hook$hook'seeds', 'database'
Returns
array

Definition at line 63 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

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

Definition at line 29 of file Seed.php.

Elgg\Database\Seeds\Seed::$limit = 20
protected

Definition at line 24 of file Seed.php.

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: