Method |
Description |
|
__construct ( spot\Locator $locator, $entityName ) |
Constructor Method |
|
all ( ) : Query |
Find all records |
|
belongsTo ( EntityInterface $entity, $foreignEntity, $localKey ) |
Relation: BelongsTo |
|
build ( array $data ) : object |
Get a new entity object, set given data on it |
|
collection ( $cursor, $with = [] ) |
Create collection from Spot\Query object |
|
collectionClass ( ) : string |
Get collection class name to use |
|
config ( ) : Config |
Get config class from locator |
|
connection ( string $connectionName = null ) : Doctrine\DBAL\Connection |
Get connection to use |
|
connectionIs ( $type ) : boolean |
Test to see if collection is of the given type |
|
convertToDatabaseValues ( string $entityName, array $data ) : array |
Prepare data to be dumped to the data store |
|
convertToPHPValues ( string $entityName, array $data ) : array |
Retrieve data from the data store and map it to PHP values |
|
create ( array $data, array $options = [] ) : object |
Get a new entity object, set given data on it, and save it |
|
delete ( mixed $conditions = [] ) |
Delete items matching given conditions |
|
dropTable ( ) |
Drop/delete table
Destructive and dangerous - drops entire data source and all data |
|
entity ( ) : string |
Get name of the Entity class mapper was instantiated with |
|
entityManager ( ) : Manager |
Entity manager class for storing information and meta-data about entities |
|
eventEmitter ( ) : Spot\EventEmitter |
Event emitter for this mapper |
|
exec ( string $sql, array $params = [] ) |
Execute custom query with no handling - just return affected rows
Useful for UPDATE, DELETE, and INSERT queries |
|
fieldExists ( string $field ) |
Check if field exists in defined fields |
|
fieldInfo ( string $field ) |
Check if field exists in defined fields |
|
fieldType ( string $field ) : mixed |
Return field type |
|
fields ( ) : array |
Get formatted fields with all neccesary array keys and values. |
|
fieldsDefined ( ) : array |
Get field information exactly how it is defined in the class |
|
first ( array $conditions = [] ) |
Find first record matching given conditions |
|
get ( mixed $identifier = false ) : mixed |
Get a new entity object, or an existing
entity from identifiers |
|
getMapper ( string $entityName ) : Mapper |
Get mapper for specified entity |
|
hasMany ( EntityInterface $entity, $entityName, $foreignKey, $localValue = null ) |
Relation: HasMany |
|
hasManyThrough ( EntityInterface $entity, $hasManyEntity, $throughEntity, $selectField, $whereField ) |
Relation: HasManyThrough |
|
hasOne ( EntityInterface $entity, $foreignEntity, $foreignKey ) |
Relation: HasOne |
|
insert ( mixed $entity, array $options = [] ) |
Insert record |
|
loadEvents ( ) |
Reset and load Events for mapped entity |
|
loadRelations ( EntityInterface $entity ) |
Load Relations for mapped entity |
|
migrate ( ) |
Migrate table structure changes from model to database |
|
prepareEntity ( EntityInterface $entity ) : boolean | null |
Prepare entity and load necessary objects on it |
|
primaryKey ( EntityInterface $entity ) |
Get value of primary key for given row result |
|
primaryKeyField ( ) |
Get value of primary key for given row result |
|
query ( string $sql, array $params = [] ) |
Find records with custom query |
|
queryBuilder ( ) : Query |
Begin a new database query - get query builder
Acts as a kind of factory to get the current adapter's query builder object |
|
queryClass ( ) : string |
Get query class name to use |
|
relations ( ) |
Get defined relations |
|
resolver ( ) |
Query resolver class for perparing and executing queries, then returning the results |
|
save ( EntityInterface $entity, array $options = [] ) |
Save record
Will update if primary key found, insert if not
Performs validation automatically before saving record |
|
saveBelongsToRelations ( EntityInterface $entity, array $options = [] ) : mixed |
Save related entities that have been assigned or loaded (only BelongsTo relations)
See saveHasRelations. |
|
saveHasRelations ( EntityInterface $entity, array $options = [] ) : mixed |
Save related entities that have been assigned or loaded (only HasOne, HasMany and HasManyThrough relations)
See saveBelongsToRelations. |
|
scopes ( ) : array |
Return scopes defined by this mapper. Scopes are called from the
Spot\Query object as a sort of in-context dynamic query method |
|
select ( mixed $fields = "*" ) : Query |
Begin a new database query - get query builder
Acts as a kind of factory to get the current adapter's query builder object |
|
table ( ) : string |
Get table name |
|
transaction ( Closure $work, $entityName = null ) |
Transaction with closure |
|
truncateTable ( $cascade = false ) |
Truncate table
Should delete all rows and reset serial/auto_increment keys |
|
update ( EntityInterface $entity, array $options = [] ) |
Update given entity object |
|
upsert ( array $data, array $where ) : object |
Upsert save entity - insert or update on duplicate key. Intended to be
used in conjunction with fields that are marked 'unique' |
|
validate ( EntityInterface $entity, array $options = [] ) : boolean |
Run set validation rules on fields |
|
where ( array $conditions = [] ) : Query |
Find records with given conditions
If all parameters are empty, find all records |
|