PHP Class Devise\Pages\Collections\CollectionsRepository

This class is used in many places to retreieve collection data from the database.
Mostrar archivo Open project: devisephp/cms Class Usage Examples

Public Methods

Method Description
__construct ( DvsCollectionInstance $CollectionInstance, DvsCollectionSet $CollectionSet, DvsField $Field, DvsPageVersion $PageVersion, CollectionFieldsFactory $CollectionFieldsFactory ) Construct a new repository with all the dependencies
findCollectionInstancesForCollectionSetIdAndPageVersionId ( integer $collectionSetId, integer $pageVersionId ) : EloquentCollection[CollectionInstance] Get the instances + fields for this collection set / page_version combo
findCollectionsForPageVersion ( DvsPageVersion $pageVersion ) : array($collectionName Get the list of collections for this page
findCollectionsForPageVersionId ( integer $pageVersionId ) : array When we only have the pageVersionId we can use this function as a proxy to findCollectionsForPageVersion
getInstances ( integer $pageVersionId, integer $collectionSetId ) : EloquentCollection[CollectionInstance] This is used by the /admin/pages/{pageVersionId}/collections/{collectionSetId}/instances slug
syncFieldsForInstances ( Eloquent\Collection $instances, array $collectionFields, $pageVersionId ) : Eloquent\Collection Sync fields for instances

Protected Methods

Method Description
createFieldsForInstance ( [type] $instance, $collectionFields, [type] $pageVersionId ) : [type] Creates a field for this instance
createMissingFieldsForInstances ( Eloquent\Collection $instances, array $collectionFields, $pageVersionId ) : Eloquent\Collection Creates any missing fields that may have been added later.
findMissingFieldsForInstance ( DvsCollectionInstance $instance, array $collectionFields ) : array Finds missing fields for an instance

Method Details

__construct() public method

Construct a new repository with all the dependencies
public __construct ( DvsCollectionInstance $CollectionInstance, DvsCollectionSet $CollectionSet, DvsField $Field, DvsPageVersion $PageVersion, CollectionFieldsFactory $CollectionFieldsFactory )
$CollectionInstance DvsCollectionInstance
$CollectionSet DvsCollectionSet
$Field DvsField
$PageVersion DvsPageVersion
$CollectionFieldsFactory CollectionFieldsFactory

createFieldsForInstance() protected method

Creates a field for this instance
protected createFieldsForInstance ( [type] $instance, $collectionFields, [type] $pageVersionId ) : [type]
$instance [type]
$pageVersionId [type]
return [type]

createMissingFieldsForInstances() protected method

..
protected createMissingFieldsForInstances ( Eloquent\Collection $instances, array $collectionFields, $pageVersionId ) : Eloquent\Collection
$instances Eloquent\Collection
$collectionFields array
return Eloquent\Collection

findCollectionInstancesForCollectionSetIdAndPageVersionId() public method

Get the instances + fields for this collection set / page_version combo
public findCollectionInstancesForCollectionSetIdAndPageVersionId ( integer $collectionSetId, integer $pageVersionId ) : EloquentCollection[CollectionInstance]
$collectionSetId integer
$pageVersionId integer
return EloquentCollection[CollectionInstance]

findCollectionsForPageVersion() public method

Get the list of collections for this page
public findCollectionsForPageVersion ( DvsPageVersion $pageVersion ) : array($collectionName
$pageVersion DvsPageVersion
return array($collectionName

findCollectionsForPageVersionId() public method

When we only have the pageVersionId we can use this function as a proxy to findCollectionsForPageVersion
public findCollectionsForPageVersionId ( integer $pageVersionId ) : array
$pageVersionId integer
return array

findMissingFieldsForInstance() protected method

Finds missing fields for an instance
protected findMissingFieldsForInstance ( DvsCollectionInstance $instance, array $collectionFields ) : array
$instance DvsCollectionInstance
$collectionFields array
return array

getInstances() public method

This is used by the /admin/pages/{pageVersionId}/collections/{collectionSetId}/instances slug
public getInstances ( integer $pageVersionId, integer $collectionSetId ) : EloquentCollection[CollectionInstance]
$pageVersionId integer
$collectionSetId integer
return EloquentCollection[CollectionInstance]

syncFieldsForInstances() public method

Sync fields for instances
public syncFieldsForInstances ( Eloquent\Collection $instances, array $collectionFields, $pageVersionId ) : Eloquent\Collection
$instances Eloquent\Collection
$collectionFields array
return Eloquent\Collection