Elgg  Version 3.0
Namespaces | Classes | Functions | Variables
Elgg\Database\Seeds Namespace Reference

Namespaces

 Providers
 

Classes

class  Groups
 Seed users. More...
 
class  Seed
 Abstract seed. More...
 
interface  Seedable
 Provides seedable methods for database seeding and unit tests. More...
 
class  Users
 Seed users. More...
 

Functions

 faker ($locale= 'en_US')
 Returns an instance of faker. More...
 
 getDomain ()
 Get site domain. More...
 
 getEmailDomain ()
 Get valid domain for emails. More...
 
 getRandomSubtype ()
 Returns random unique subtype. More...
 
 createUser (array $attributes=[], array $metadata=[], array $options=[])
 Create a new fake user. More...
 
 createGroup (array $attributes=[], array $metadata=[], array $options=[])
 Create a new fake group. More...
 
 createObject (array $attributes=[], array $metadata=[], array $options=[])
 Create a new fake object. More...
 
 createSite (array $attributes=[], array $metadata=[])
 Create a new fake site. 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 ($name=null)
 Generates a unique available and valid username. More...
 
 getRandomEmail ($base=null)
 Generate a random valid email. 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=LogLevel::NOTICE)
 Log a message. More...
 

Variables

trait Seeding
 Seeding trait Can be used to easily create new random users, groups and objects in the database. More...
 
 $faker
 

Function Documentation

Elgg\Database\Seeds\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 695 of file Seeding.php.

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

Create a new fake group.

Parameters
array$attributesGroup entity attributes
array$metadataGroup entity metadata
array$optionsAdditional options
Returns
ElggGroup

Definition at line 206 of file Seeding.php.

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

Create an icon for an entity.

Parameters
ElggEntity$entityEntity
Returns
bool

Definition at line 666 of file Seeding.php.

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

Create likes.

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

Definition at line 732 of file Seeding.php.

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

Create a new fake object.

Parameters
array$attributesObject entity attributes
array$metadataObject entity metadata
array$optionsAdditional options
Returns
ElggObject

Definition at line 328 of file Seeding.php.

Elgg\Database\Seeds\createSite ( array  $attributes = [],
array  $metadata = [] 
)

Create a new fake site.

Parameters
array$attributesObject entity attributes
array$metadataObject entity metadata
Returns

Definition at line 430 of file Seeding.php.

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

Create a new fake user.

Parameters
array$attributesUser entity attributes
array$metadataUser entity metadata
array$optionsSeeding options
Returns
ElggUser

Definition at line 97 of file Seeding.php.

Elgg\Database\Seeds\faker (   $locale = 'en_US')

Returns an instance of faker.

Parameters
string$localeLocale
Returns

Definition at line 43 of file Seeding.php.

Elgg\Database\Seeds\getDomain ( )

Get site domain.

Returns
string

Definition at line 57 of file Seeding.php.

Elgg\Database\Seeds\getEmailDomain ( )

Get valid domain for emails.

Returns
string

Definition at line 65 of file Seeding.php.

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

Get random access id.

Parameters
ElggUser$userUser
ElggEntity$containerContainer
Returns
int

Definition at line 495 of file Seeding.php.

Elgg\Database\Seeds\getRandomEmail (   $base = null)

Generate a random valid email.

Parameters
string$baseEmail username part
Returns
string

Definition at line 548 of file Seeding.php.

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

Returns random fake group.

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

Definition at line 468 of file Seeding.php.

Elgg\Database\Seeds\getRandomSubtype ( )

Returns random unique subtype.

Returns
bool|string

Definition at line 84 of file Seeding.php.

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

Returns random fake user.

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

Definition at line 442 of file Seeding.php.

Elgg\Database\Seeds\getRandomUsername (   $name = null)

Generates a unique available and valid username.

Parameters
string$nameDisplay name or other prefix to use as basis
Returns
string

Definition at line 515 of file Seeding.php.

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

Log a message.

Parameters
string$msgMessage to log
string$levelMessage level Note that 'ERROR' will terminate further code execution
Returns
void
Examples:
/root/Elgg/engine/lib/output.php.

Definition at line 762 of file Seeding.php.

Elgg\Database\Seeds\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 581 of file Seeding.php.

Variable Documentation

Elgg::Database::Seeds\$faker
protected

Definition at line 34 of file Seeding.php.

trait Elgg::Database::Seeds\Seeding
Initial value:
{
protected $limit = 20
$limit
Definition: userpicker.php:52

Seeding trait Can be used to easily create new random users, groups and objects in the database.

Definition at line 24 of file Seeding.php.