Primordyx Framework Documentation

SeedCommand extends AbstractCommand
in package

Table of Contents

Methods

execute()  : void
Execute the command
getDescription()  : string
Get the command description
getDetailedHelp()  : string
Get detailed help text for this command
getName()  : string
Get the command name
error()  : never
Output an error and exit
out()  : void
Output a message
createDatabaseConnection()  : PDO
Create PDO connection to target database using Config
getDefaultDatabase()  : string
Get the default database name from configuration
parseOptions()  : array<string|int, mixed>
Parse command line options
runAllSeeders()  : void
Run all seeders in directory
runPhpSeeder()  : void
Run PHP seeder class
runSpecificSeeder()  : void
Run a specific seeder
runSqlSeeder()  : void
Run SQL seeder file

Methods

execute()

Execute the command

public execute(array<string|int, mixed> $args) : void
Parameters
$args : array<string|int, mixed>

Command line arguments

Tags
inheritDoc

getDescription()

Get the command description

public getDescription() : string
Tags
inheritDoc
Return values
string

A brief description of what this command does

getDetailedHelp()

Get detailed help text for this command

public getDetailedHelp() : string
Tags
inheritDoc
Return values
string

getName()

Get the command name

public getName() : string
Tags
inheritDoc
Return values
string

The unique name identifier for this command

error()

Output an error and exit

protected error(string $message) : never
Parameters
$message : string
Return values
never

out()

Output a message

protected out(string $message) : void
Parameters
$message : string

createDatabaseConnection()

Create PDO connection to target database using Config

private createDatabaseConnection(string $databaseName) : PDO
Parameters
$databaseName : string

Target database name

Tags
throws
RuntimeException

If configuration missing or connection fails

Return values
PDO

getDefaultDatabase()

Get the default database name from configuration

private getDefaultDatabase() : string
Return values
string

parseOptions()

Parse command line options

private parseOptions(array<string|int, mixed> $args) : array<string|int, mixed>
Parameters
$args : array<string|int, mixed>
Return values
array<string|int, mixed>

runAllSeeders()

Run all seeders in directory

private runAllSeeders(string $seedsPath, string $databaseName, bool $dryRun) : void
Parameters
$seedsPath : string
$databaseName : string
$dryRun : bool

runPhpSeeder()

Run PHP seeder class

private runPhpSeeder(string $filePath, string $databaseName, bool $dryRun) : void
Parameters
$filePath : string
$databaseName : string
$dryRun : bool

runSpecificSeeder()

Run a specific seeder

private runSpecificSeeder(string $seederName, string $seedsPath, string $databaseName, bool $dryRun) : void
Parameters
$seederName : string
$seedsPath : string
$databaseName : string
$dryRun : bool

runSqlSeeder()

Run SQL seeder file

private runSqlSeeder(string $filePath, string $databaseName, bool $dryRun) : void
Parameters
$filePath : string
$databaseName : string
$dryRun : bool

        
On this page

Search results