PHP Class Devise\Pages\Interpreter\TagManager

Datei anzeigen Open project: devisephp/cms Class Usage Examples

Protected Properties

Property Type Description
$CollectionsRepository Devise\Pages\Collections\CollectionsRepository Collections Repository to fiddle with collections
$DvsCollectionSet DvsCollectionSet Dvs Collection Set model
$DvsField DvsField Dvs Field model
$DvsGlobalField DvsGlobalField Dvs Global Field model
$DvsModelField DvsModelField Dvs Model Field model
$languageId integer Language id
$pageId integer Page id
$pageVersionId integer Page version id

Public Methods

Method Description
__construct ( DvsField $DvsField, DvsGlobalField $DvsGlobalField, DvsCollectionSet $DvsCollectionSet, DvsModelField $DvsModelField, CollectionsRepository $CollectionsRepository ) Create a new tag manager
getInstanceForTag ( array $tag ) : DvsField | DvsCollection | DvsModelField | DvsGlobalField Find this tag in the database
initialize ( integer $pageId, integer $pageVersionId, integer $languageId ) : void Initializes values for our tag manager

Protected Methods

Method Description
assertInitialized ( ) : void Assert that pageId, pageVersionId and languageId are all set
createCollectionSet ( array $tag ) : DvsCollectionSet Create a collection set from this tag
createFieldInstance ( array $tag ) : DvsField Create a new field instance
createMissingModelFields ( array $tag, $fields, $mappings ) : void Ensures that all model fields are created for a model's picks
createModelField ( integer $modelId, string $modelType, string $mapping ) : DvsModelField Creates this model field for us in the database this will also restore an existing soft deleted model field if it finds one.
fetchMappingsForModelField ( array $tag ) : array Finds the mappings for this model type This allows us to know if we have created enough DvsModelField entries in the database
fetchModelFields ( integer $modelId, string $modelType, array $mappings, $onlyTrashed = false ) : Collection Fetch all the model fields
filterModelFieldByAttribute ( $modelFields, string $attribute ) : DvsModelField Filters out the attribute from this model field
findField ( array $tag ) : DvsField Find the field in the database
findGlobalField ( array $tag ) : DvsGlobalField Finds a global field for this tag
getInstanceForAttribute ( array $tag ) : DvsModelField Get the instance for a model attribute in this tag
getInstanceForCollection ( array $tag ) : DvsCollectionSet Get the instance of a collection. This is the CollectionSet with all instances attached
getInstanceForCreator ( array $tag ) : StdClass There is no database instance for creators.
getInstanceForField ( $tag ) : DvsField | DvsGlobalField Find this field in database
getInstanceForModel ( array $tag ) : DvsModelField Get the instance for a model in this tag
getInstanceForVariable ( array $tag ) : array Get the instance for a variable type. We cannot do much with this since we haven't identified what type of variable this is, e.g. model or attribute.
restoreFieldInstance ( array $tag ) : DvsField If there is a field instance that has been deleted, then we restore it cuz we need it again
updateInstance ( Eloquent $instance, array $fields ) : void Updates an instance with the fields given but only if the field values are different than what is already in the database

Method Details

__construct() public method

Create a new tag manager
public __construct ( DvsField $DvsField, DvsGlobalField $DvsGlobalField, DvsCollectionSet $DvsCollectionSet, DvsModelField $DvsModelField, CollectionsRepository $CollectionsRepository )
$DvsField DvsField
$DvsGlobalField DvsGlobalField
$DvsCollectionSet DvsCollectionSet
$DvsModelField DvsModelField
$CollectionsRepository Devise\Pages\Collections\CollectionsRepository

assertInitialized() protected method

Assert that pageId, pageVersionId and languageId are all set
protected assertInitialized ( ) : void
return void

createCollectionSet() protected method

Create a collection set from this tag
protected createCollectionSet ( array $tag ) : DvsCollectionSet
$tag array
return DvsCollectionSet

createFieldInstance() protected method

Create a new field instance
protected createFieldInstance ( array $tag ) : DvsField
$tag array
return DvsField

createMissingModelFields() protected method

Ensures that all model fields are created for a model's picks
protected createMissingModelFields ( array $tag, $fields, $mappings ) : void
$tag array
return void

createModelField() protected method

..
protected createModelField ( integer $modelId, string $modelType, string $mapping ) : DvsModelField
$modelId integer
$modelType string
$mapping string
return DvsModelField

fetchMappingsForModelField() protected method

Finds the mappings for this model type This allows us to know if we have created enough DvsModelField entries in the database
protected fetchMappingsForModelField ( array $tag ) : array
$tag array
return array

fetchModelFields() protected method

Fetch all the model fields
protected fetchModelFields ( integer $modelId, string $modelType, array $mappings, $onlyTrashed = false ) : Collection
$modelId integer
$modelType string
$mappings array
return Collection

filterModelFieldByAttribute() protected method

Filters out the attribute from this model field
protected filterModelFieldByAttribute ( $modelFields, string $attribute ) : DvsModelField
$attribute string
return DvsModelField

findField() protected method

Find the field in the database
protected findField ( array $tag ) : DvsField
$tag array
return DvsField

findGlobalField() protected method

Finds a global field for this tag
protected findGlobalField ( array $tag ) : DvsGlobalField
$tag array
return DvsGlobalField

getInstanceForAttribute() protected method

Get the instance for a model attribute in this tag
protected getInstanceForAttribute ( array $tag ) : DvsModelField
$tag array
return DvsModelField

getInstanceForCollection() protected method

Get the instance of a collection. This is the CollectionSet with all instances attached
protected getInstanceForCollection ( array $tag ) : DvsCollectionSet
$tag array
return DvsCollectionSet

getInstanceForCreator() protected method

.. this doesn't really make sense, but it is here for the sake of consistency, since all the other tag types have database stuff
protected getInstanceForCreator ( array $tag ) : StdClass
$tag array
return StdClass

getInstanceForField() protected method

Find this field in database
protected getInstanceForField ( $tag ) : DvsField | DvsGlobalField
$tag
return DvsField | DvsGlobalField | DvsGlobalField

getInstanceForModel() protected method

Get the instance for a model in this tag
protected getInstanceForModel ( array $tag ) : DvsModelField
$tag array
return DvsModelField

getInstanceForTag() public method

Find this tag in the database
public getInstanceForTag ( array $tag ) : DvsField | DvsCollection | DvsModelField | DvsGlobalField
$tag array
return DvsField | DvsCollection | DvsModelField | DvsGlobalField | DvsCollection | DvsModelField | DvsGlobalField

getInstanceForVariable() protected method

Get the instance for a variable type. We cannot do much with this since we haven't identified what type of variable this is, e.g. model or attribute.
protected getInstanceForVariable ( array $tag ) : array
$tag array
return array

initialize() public method

Initializes values for our tag manager
public initialize ( integer $pageId, integer $pageVersionId, integer $languageId ) : void
$pageId integer
$pageVersionId integer
$languageId integer
return void

restoreFieldInstance() protected method

If there is a field instance that has been deleted, then we restore it cuz we need it again
protected restoreFieldInstance ( array $tag ) : DvsField
$tag array
return DvsField

updateInstance() protected method

Updates an instance with the fields given but only if the field values are different than what is already in the database
protected updateInstance ( Eloquent $instance, array $fields ) : void
$instance Eloquent
$fields array
return void

Property Details

$CollectionsRepository protected_oe property

Collections Repository to fiddle with collections
protected CollectionsRepository,Devise\Pages\Collections $CollectionsRepository
return Devise\Pages\Collections\CollectionsRepository

$DvsCollectionSet protected_oe property

Dvs Collection Set model
protected DvsCollectionSet $DvsCollectionSet
return DvsCollectionSet

$DvsField protected_oe property

Dvs Field model
protected DvsField $DvsField
return DvsField

$DvsGlobalField protected_oe property

Dvs Global Field model
protected DvsGlobalField $DvsGlobalField
return DvsGlobalField

$DvsModelField protected_oe property

Dvs Model Field model
protected DvsModelField $DvsModelField
return DvsModelField

$languageId protected_oe property

Language id
protected int $languageId
return integer

$pageId protected_oe property

Page id
protected int $pageId
return integer

$pageVersionId protected_oe property

Page version id
protected int $pageVersionId
return integer