Property | Type | Description | |
---|---|---|---|
$_blueprints | * Array of collection name => Blueprint | ||
$_db | * Mongo database object |
Method | Description | |
---|---|---|
__construct ( MongoDB $mongo ) | Constructs a Phactory object for testing MongoDB databases | |
build ( $blueprint_name, $overrides = [] ) | * Build a document as an array, optionally overriding some or all of the default values. | |
buildWithAssociations ( $blueprint_name, $associations = [], $overrides = [] ) | * Build a document as an array, optionally overriding some or all of the default values. | |
create ( $blueprint_name, $overrides = [] ) | * Instantiate a document in the specified collection, optionally overriding some or all of the default values. | |
createWithAssociations ( $blueprint_name, $associations = [], $overrides = [] ) | * Instantiate a document in the specified collection, optionally overriding some or all of the default values. | |
define ( $blueprint_name, $defaults, $associations = [] ) | * Define the default values to use when constructing a document in the specified collection. | |
defineBlueprint ( $blueprint_name, $defaults, $associations = [] ) | * alias for define per @jblotus pull request eventually we should just rename the original function | |
embedsMany ( $collection_name ) | * Create an embeds-many association object for use in define(). | |
embedsOne ( $collection_name ) | * Create an embeds-one association object for use in define(). | |
get ( $collection_name, $query ) | * Get a document from the database as an array. | |
getAll ( $collection_name, $query = [] ) | * Get results from the database as a cursor. | |
getDb ( ) | * Get the Mongo database object. | |
recall ( ) | * Delete created documents from the database. | |
reset ( ) | * Delete created objects from the database, clear defined blueprints, and clear stored inflection exceptions. | |
setDb ( MongoDB $db ) | * Set the Mongo object to use for database connection. | |
setInflection ( $singular, $plural ) | * Specify an exception for collection name inflection. |
public __construct ( MongoDB $mongo ) | ||
$mongo | MongoDB | A MongoDB database connection to test with |
public build ( $blueprint_name, $overrides = [] ) | ||
$blueprint_name | name of the blueprint | |
$overrides | key => value pairs of column => value |
public buildWithAssociations ( $blueprint_name, $associations = [], $overrides = [] ) | ||
$blueprint_name | name of the blueprint to use | |
$associations | [collection name] => [array] | |
$overrides | key => value pairs of field => value |
public create ( $blueprint_name, $overrides = [] ) | ||
$blueprint_name | name of the blueprint | |
$overrides | key => value pairs of column => value |
public createWithAssociations ( $blueprint_name, $associations = [], $overrides = [] ) | ||
$blueprint_name | name of the blueprint to use | |
$associations | [collection name] => [array] | |
$overrides | key => value pairs of field => value |
public define ( $blueprint_name, $defaults, $associations = [] ) | ||
$blueprint_name | singular name of the collection in the database | |
$defaults | key => value pairs of field => value, or a phactory_blueprint | |
$associations | array of phactory_associations |
public defineBlueprint ( $blueprint_name, $defaults, $associations = [] ) |
public embedsMany ( $collection_name ) | ||
$collection_name | the singular name of the collection to associate with |
public embedsOne ( $collection_name ) | ||
$collection_name | the singular name of the collection to associate with |
public get ( $collection_name, $query ) | ||
$collection_name | name of the collection | |
$query | a MongoDB query |
public getAll ( $collection_name, $query = [] ) | ||
$collection_name | name of the collection | |
$query | a MongoDB query |
public reset ( ) |
public setDb ( MongoDB $db ) | ||
$db | MongoDB | Mongo object |
public setInflection ( $singular, $plural ) | ||
$singular | singular form of the word. | |
$plural | plural form of the word. |