Elgg  Version 2.3
Public 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\Groups Elgg\Database\Seeds\Objects Elgg\Database\Seeds\Users

Public Member Functions

 __construct ($locale= 'en_US')
 Seed constructor. More...
 
 seed ()
 Populate database. More...
 
 unseed ()
 Removed seeded rows from database. More...
 
 getDomain ()
 Get site domain. More...
 
 createUser (array $attributes=[], array $metadata=[])
 Create a new faker user. More...
 
 createGroup (array $attributes=[], array $metadata=[])
 Create a new faker group. More...
 
 createObject (array $attributes=[], array $metadata=[])
 Create a new faker object. More...
 
 getRandomUser (array $exclude=[])
 Returns random fake user. More...
 
 getRandomGroup (array $exclude=[])
 Returns random fake group. More...
 
 getRandomAccessId (\ElggUser $user=null, ElggEntity $container=null)
 Get random access id. More...
 
 getRandomUsername ($base_name= 'user')
 Generates a unique available and valid username. More...
 
 populateMetadata (ElggEntity $entity, array $fields=[], array $metadata=[])
 Set random metadata. More...
 
 createIcon (ElggEntity $entity)
 Create an icon for an entity. More...
 
 createComments (ElggEntity $entity, $limit=null)
 Create comments/replies. More...
 
 createLikes (ElggEntity $entity, $limit=null)
 Create likes. More...
 
 log ($msg, $level= 'NOTICE')
 Log a message. More...
 

Protected Attributes

 $limit = 3
 
 $faker
 

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 20 of file Seed.php.

Constructor & Destructor Documentation

Elgg\Database\Seeds\Seed::__construct (   $locale = 'en_US')

Seed constructor.

Parameters
string$localeLocale

Definition at line 37 of file Seed.php.

Member Function Documentation

Elgg\Database\Seeds\Seed::createComments ( ElggEntity  $entity,
  $limit = null 
)

Create comments/replies.

Parameters
ElggEntity$entityEntity to comment on
int$limitNumber of comments to create
Returns
int Number of generated comments

Definition at line 628 of file Seed.php.

Elgg\Database\Seeds\Seed::createGroup ( array  $attributes = [],
array  $metadata = [] 
)

Create a new faker group.

Returns
ElggGroup|false

Definition at line 132 of file Seed.php.

Elgg\Database\Seeds\Seed::createIcon ( ElggEntity  $entity)

Create an icon for an entity.

Parameters
ElggEntity$entityEntity
Returns
bool

Definition at line 599 of file Seed.php.

Elgg\Database\Seeds\Seed::createLikes ( ElggEntity  $entity,
  $limit = null 
)

Create likes.

Parameters
ElggEntity$entityEntity to like
int$limitNumber of likes to create
Returns
int

Definition at line 661 of file Seed.php.

Elgg\Database\Seeds\Seed::createObject ( array  $attributes = [],
array  $metadata = [] 
)

Create a new faker object.

Returns
ElggObject|false

Definition at line 244 of file Seed.php.

Elgg\Database\Seeds\Seed::createUser ( array  $attributes = [],
array  $metadata = [] 
)

Create a new faker user.

Returns
ElggUser|false

Definition at line 67 of file Seed.php.

Elgg\Database\Seeds\Seed::getDomain ( )

Get site domain.

Returns
string

Definition at line 59 of file Seed.php.

Elgg\Database\Seeds\Seed::getRandomAccessId ( \ElggUser  $user = null,
ElggEntity  $container = null 
)

Get random access id.

Parameters
ElggUser$userUser
ElggEntity$containerContainer
Returns
int

Definition at line 406 of file Seed.php.

Elgg\Database\Seeds\Seed::getRandomGroup ( array  $exclude = [])

Returns random fake group.

Parameters
int[]$exclude GUIDs to exclude
Returns
ElggGroup|false

Definition at line 378 of file Seed.php.

Elgg\Database\Seeds\Seed::getRandomUser ( array  $exclude = [])

Returns random fake user.

Parameters
int[]$exclude GUIDs to exclude
Returns
ElggUser|false

Definition at line 351 of file Seed.php.

Elgg\Database\Seeds\Seed::getRandomUsername (   $base_name = 'user')

Generates a unique available and valid username.

Parameters
string$base_nameDisplay name, email or other prefix to use as basis
Returns
string

Definition at line 426 of file Seed.php.

Elgg\Database\Seeds\Seed::log (   $msg,
  $level = 'NOTICE' 
)

Log a message.

Parameters
string$msgMessage to log
Returns
void

Definition at line 685 of file Seed.php.

Elgg\Database\Seeds\Seed::populateMetadata ( ElggEntity  $entity,
array  $fields = [],
array  $metadata = [] 
)

Set random metadata.

Parameters
ElggEntity$entityEntity
array$fieldsAn array of profile fields in $name => $input_type format
array$metadataOther metadata $name => $value pairs to set
Returns
ElggEntity

Definition at line 522 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::$faker
protected

Definition at line 30 of file Seed.php.

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

Definition at line 25 of file Seed.php.


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