ResourcePopulator
in package
Class for populating record rows in the resource table of the database
Tags
Table of Contents
- $dateConverter : Converter
- $loader : Loader
- $resourceService : ResourceServiceInterface
- __construct() : void
- Constructor
- assignMetadata() : ResourceEntityInterface
- Use a record driver to assign metadata to the current row. Return the current object to allow fluent interface.
- createAndPersistResourceForDriver() : ResourceEntityInterface
- Create and a ResourceEntityInterface object populated with data from the provided record driver.
- createAndPersistResourceForRecordId() : ResourceEntityInterface
- Create and persist a ResourceEntityInterface object populated with data from the record driver looked up using the provided record ID and source.
- createResourceForDriver() : ResourceEntityInterface
- Create (but do not persist) a ResourceEntityInterface object populated with data from the provided record driver.
- createResourceForRecordId() : ResourceEntityInterface
- Create (but do not persist) a ResourceEntityInterface object populated with data from the record driver looked up using the provided record ID and source.
- getOrCreateResourceForDriver() : ResourceEntityInterface
- Retrieve an existing row matching the provided record driver if it exists; create, populate and persist it if it does not.
- getOrCreateResourceForRecordId() : ResourceEntityInterface
- Retrieve an existing row matching the provided id/source if it exists; create, populate and persist it if it does not.
Properties
$dateConverter
protected
Converter
$dateConverter
$loader
protected
Loader
$loader
$resourceService
protected
ResourceServiceInterface
$resourceService
Methods
__construct()
Constructor
public
__construct(ResourceServiceInterface $resourceService, Loader $loader, Converter $dateConverter) : void
Parameters
- $resourceService : ResourceServiceInterface
-
Resource database service
- $loader : Loader
-
Record loader
- $dateConverter : Converter
-
Date converter
Return values
void —assignMetadata()
Use a record driver to assign metadata to the current row. Return the current object to allow fluent interface.
public
assignMetadata(ResourceEntityInterface $resource, AbstractBase $driver) : ResourceEntityInterface
Parameters
- $resource : ResourceEntityInterface
-
The resource to populate
- $driver : AbstractBase
-
The record driver to populate from
Return values
ResourceEntityInterface —createAndPersistResourceForDriver()
Create and a ResourceEntityInterface object populated with data from the provided record driver.
public
createAndPersistResourceForDriver(AbstractBase $driver) : ResourceEntityInterface
Parameters
- $driver : AbstractBase
-
Record driver
Return values
ResourceEntityInterface —createAndPersistResourceForRecordId()
Create and persist a ResourceEntityInterface object populated with data from the record driver looked up using the provided record ID and source.
public
createAndPersistResourceForRecordId(string $id, string $source) : ResourceEntityInterface
Parameters
- $id : string
-
Record id
- $source : string
-
Record source
Return values
ResourceEntityInterface —createResourceForDriver()
Create (but do not persist) a ResourceEntityInterface object populated with data from the provided record driver.
public
createResourceForDriver(AbstractBase $driver) : ResourceEntityInterface
Parameters
- $driver : AbstractBase
-
Record driver
Return values
ResourceEntityInterface —createResourceForRecordId()
Create (but do not persist) a ResourceEntityInterface object populated with data from the record driver looked up using the provided record ID and source.
public
createResourceForRecordId(string $id, string $source) : ResourceEntityInterface
Parameters
- $id : string
-
Record id
- $source : string
-
Record source
Return values
ResourceEntityInterface —getOrCreateResourceForDriver()
Retrieve an existing row matching the provided record driver if it exists; create, populate and persist it if it does not.
public
getOrCreateResourceForDriver(AbstractBase $driver) : ResourceEntityInterface
Parameters
- $driver : AbstractBase
-
Record driver
Return values
ResourceEntityInterface —getOrCreateResourceForRecordId()
Retrieve an existing row matching the provided id/source if it exists; create, populate and persist it if it does not.
public
getOrCreateResourceForRecordId(string $id, string $source) : ResourceEntityInterface
Parameters
- $id : string
-
Record id
- $source : string
-
Record source