\Phinx\SeedAbstractSeed

Abstract Seed Class.

It is expected that the seeds you write extend from this class.

This abstract class proxies the various database methods to your specified adapter.

Summary

Methods
Properties
Constants
__construct()
run()
setAdapter()
getAdapter()
setInput()
getInput()
setOutput()
getOutput()
getName()
execute()
query()
fetchRow()
fetchAll()
insert()
hasTable()
table()
No public properties found
No constants found
init()
$adapter
$input
$output
N/A
No private methods found
No private properties found
N/A

Properties

Methods

run()

run() : void

Run the seeder.

setAdapter()

setAdapter(\Phinx\Db\Adapter\AdapterInterface  $adapter) : \Phinx\Seed\MigrationInterface

Sets the database adapter.

Parameters

\Phinx\Db\Adapter\AdapterInterface $adapter

Database Adapter

Returns

\Phinx\Seed\MigrationInterface

setInput()

setInput(\think\console\Input  $input) : \Phinx\Seed\MigrationInterface

Sets the input object to be used in migration object

Parameters

\think\console\Input $input

Returns

\Phinx\Seed\MigrationInterface

getInput()

getInput() : \think\console\Input

Gets the input object to be used in migration object

Returns

\think\console\Input

setOutput()

setOutput(\think\console\Output  $output) : \Phinx\Seed\MigrationInterface

Sets the output object to be used in migration object

Parameters

\think\console\Output $output

Returns

\Phinx\Seed\MigrationInterface

getOutput()

getOutput() : \think\console\Output

Gets the output object to be used in migration object

Returns

\think\console\Output

getName()

getName() : string

Gets the name.

Returns

string

execute()

execute(string  $sql) : integer

Executes a SQL statement and returns the number of affected rows.

Parameters

string $sql

SQL

Returns

integer

query()

query(string  $sql) : array

Executes a SQL statement and returns the result as an array.

Parameters

string $sql

SQL

Returns

array

fetchRow()

fetchRow(string  $sql) : array

Executes a query and returns only one row as an array.

Parameters

string $sql

SQL

Returns

array

fetchAll()

fetchAll(string  $sql) : array

Executes a query and returns an array of rows.

Parameters

string $sql

SQL

Returns

array

insert()

insert(  $table, array  $data) : void

Insert data into a table.

Parameters

$table
array $data

hasTable()

hasTable(string  $tableName) : boolean

Checks to see if a table exists.

Parameters

string $tableName

Table Name

Returns

boolean

table()

table(string  $tableName, array  $options = array()) : \Phinx\Db\Table

Returns an instance of the <code>\Table</code> class.

You can use this class to create and manipulate tables.

Parameters

string $tableName

Table Name

array $options

Options

Returns

\Phinx\Db\Table

init()

init() : void

Initialize method.