Property | Type | Description | |
---|---|---|---|
$_blueprints | * Array of table name => Blueprint | ||
$_pdo | * PDO database connection |
Method | Description | |
---|---|---|
__construct ( PDO $pdo ) | Constructs a Phactory object for testing SQL databases | |
build ( $table, $overrides = [] ) | * Build a Row object, optionally overriding some or all of the default values. | |
buildWithAssociations ( $blueprint_name, $associations = [], $overrides = [] ) | * Build a Row object, optionally overriding some or all of the default values. | |
create ( $table, $overrides = [] ) | * Instantiate a row in the specified table, optionally overriding some or all of the default values. | |
createWithAssociations ( $blueprint_name, $associations = [], $overrides = [] ) | * Instantiate a row in the specified table, optionally overriding some or all of the default values. | |
define ( $blueprint_name, $defaults = [], $associations = [] ) | * Define the default values to use when constructing a row in the specified table. | |
defineBlueprint ( $blueprint_name, $defaults = [], $associations = [] ) | * alias for define per @jblotus pull request eventually we should just rename the original function | |
get ( $table_name, $byColumns ) | * Get a row from the database as a Row. | |
getAll ( $table_name, $byColumns ) | ||
getConnection ( ) | * Get the PDO database connection object. | |
manyToMany ( $to_table, $join_table, $from_column = null, $from_join_column = null, $to_join_column = null, $to_column = null ) | ||
manyToOne ( $to_table, $from_column = null, $to_column = null ) | * Create a many-to-one association object for use in define(). | |
oneToOne ( $to_table, $from_column, $to_column = null ) | * Create a one-to-one association object for use in define(). | |
recall ( ) | * Delete created Row objects from the database. | |
reset ( ) | * Delete created objects from the database, clear defined blueprints, and clear stored inflection exceptions. | |
setConnection ( $pdo ) | * Set the PDO object to use for database connection. | |
setInflection ( $singular, $plural ) | * Specify an exception for table name inflection. |
public __construct ( PDO $pdo ) | ||
$pdo | PDO | A PDO database connection to test with |
public build ( $table, $overrides = [] ) | ||
$table | name of the table | |
$overrides | key => value pairs of column => value |
public buildWithAssociations ( $blueprint_name, $associations = [], $overrides = [] ) | ||
$blueprint_name | name of the blueprint to use | |
$associations | [table name] => [Row] | |
$overrides | key => value pairs of column => value |
public create ( $table, $overrides = [] ) | ||
$table | name of the table | |
$overrides | key => value pairs of column => value |
public createWithAssociations ( $blueprint_name, $associations = [], $overrides = [] ) | ||
$blueprint_name | name of the blueprint to use | |
$associations | [table name] => [Row] | |
$overrides | key => value pairs of column => value |
public define ( $blueprint_name, $defaults = [], $associations = [] ) | ||
$blueprint_name | singular name of the table in the database | |
$defaults | key => value pairs of column => value, or a phactory_blueprint | |
$associations | array of phactory_associations |
public defineBlueprint ( $blueprint_name, $defaults = [], $associations = [] ) |
public get ( $table_name, $byColumns ) | ||
$table_name | name of the table |
public manyToMany ( $to_table, $join_table, $from_column = null, $from_join_column = null, $to_join_column = null, $to_column = null ) |
public manyToOne ( $to_table, $from_column = null, $to_column = null ) | ||
$to_table | the table to associate with | |
$from_column | the fk column on the left table | |
$to_column | the pk column of the right table, or null to autodetect |
public oneToOne ( $to_table, $from_column, $to_column = null ) | ||
$to_table | the table to associate with | |
$from_column | the fk column on the left table | |
$to_column | the pk column of the right table, or null to autodetect |
public reset ( ) |
public setConnection ( $pdo ) | ||
$pdo | PDO object |
public setInflection ( $singular, $plural ) | ||
$singular | singular form of the word. | |
$plural | plural form of the word. |