PHP Class Pimcore\Model\Element\Service

Inheritance: extends Pimcore\Model\AbstractModel
Show file Open project: pimcore/pimcore Class Usage Examples

Public Methods

Method Description
addTreeFilterJoins ( $cv, $childsList ) Changes the query according to the custom view config
cleanupBrokenViews ( ) clean up broken views which were generated by localized fields, .
correctPath ( string $path ) : string
createFolderByPath ( $path, array $options = [] ) : Folder | Folder | Folder
findForbiddenPaths ( string $type, $user ) : array find all elements which the user may not list and therefore may never be shown to the user
fixAllowedTypes ( $data, $type )
getCustomViewById ( $id )
getDependedElement ( array $config ) : AbstractObject | Document | Asset
getDependencyForFrontend ( Document | Asset | AbstractObject $element ) : array
getElementById ( string $type, integer $id ) : Pimcore\Model\Element\ElementInterface
getElementByPath ( string $type, string $path ) : Pimcore\Model\Element\ElementInterface
getElementType ( Pimcore\Model\Element\ElementInterface $element ) : string
getFilename ( Pimcore\Model\Element\ElementInterface $element ) : string
getIdList ( $list, $idGetter = 'getId' ) : array
getIdPath ( $element ) : string
getRequiredByDependenciesForFrontend ( Dependency $d ) : array
getRequiresDependenciesForFrontend ( Dependency $d ) : array
getSafeVersionInfo ( $versions )
getSaveCopyName ( string $type, string $sourceKey, Pimcore\Model\Element\ElementInterface $target ) : Pimcore\Model\Element\ElementInterface | string Returns a uniqe key for the element in the $target-Path (recursive)
getType ( Pimcore\Model\Element\ElementInterface $element ) : string determines the type of an element (object,asset,document)
getTypePath ( $element ) : string
getUniqueKey ( $element ) : string returns a unique key for an element
getValidKey ( $key, null $type ) : mixed | string
gridElementData ( Pimcore\Model\Element\ElementInterface $element ) : array
isPublished ( Pimcore\Model\Element\ElementInterface $element = null ) : boolean determines whether an element is published
isValidKey ( $key, $type ) : boolean
loadAllFields ( Pimcore\Model\Element\ElementInterface $element ) : Pimcore\Model\Element\ElementInterface
minimizePropertiesForEditmode ( $props ) : array
pathExists ( $path, $type = null ) : boolean
renewReferences ( Document | Asset | AbstractObject $data, $initial = true ) : mixed renews all references, for example after unserializing an ElementInterface
runSanityCheck ( )
scheduleForSanityCheck ( Pimcore\Model\Element\ElementInterface $element ) : void Schedules element with this id for sanity check to be cleaned of broken relations

Protected Methods

Method Description
performSanityCheck ( Pimcore\Model\Element\ElementInterface $element ) : void
updateChilds ( Pimcore\Model\Element\ElementInterface $target, Pimcore\Model\Element\ElementInterface $new ) : void

Private Methods

Method Description
filterNullValues ( $var ) : boolean Callback for array_filter function.

Method Details

addTreeFilterJoins() public static method

Changes the query according to the custom view config
public static addTreeFilterJoins ( $cv, $childsList )
$cv array
$childsList

cleanupBrokenViews() public method

... when removing a language the view isn't valid anymore
public cleanupBrokenViews ( )

correctPath() public static method

public static correctPath ( string $path ) : string
$path string
return string

createFolderByPath() public static method

public static createFolderByPath ( $path, array $options = [] ) : Folder | Folder | Folder
$path
$options array
return Pimcore\Model\Asset\Folder | Pimcore\Model\Document\Folder | Pimcore\Model\Object\Folder

findForbiddenPaths() public static method

find all elements which the user may not list and therefore may never be shown to the user
public static findForbiddenPaths ( string $type, $user ) : array
$type string asset|object|document
return array

fixAllowedTypes() public static method

public static fixAllowedTypes ( $data, $type )

getCustomViewById() public static method

public static getCustomViewById ( $id )

getDependedElement() public static method

public static getDependedElement ( array $config ) : AbstractObject | Document | Asset
$config array
return Pimcore\Model\Object\AbstractObject | Pimcore\Model\Document | Pimcore\Model\Asset

getDependencyForFrontend() public static method

public static getDependencyForFrontend ( Document | Asset | AbstractObject $element ) : array
$element Pimcore\Model\Document | Pimcore\Model\Asset | Pimcore\Model\Object\AbstractObject
return array

getElementById() public static method

public static getElementById ( string $type, integer $id ) : Pimcore\Model\Element\ElementInterface
$type string
$id integer
return Pimcore\Model\Element\ElementInterface

getElementByPath() public static method

public static getElementByPath ( string $type, string $path ) : Pimcore\Model\Element\ElementInterface
$type string
$path string
return Pimcore\Model\Element\ElementInterface

getElementType() public static method

public static getElementType ( Pimcore\Model\Element\ElementInterface $element ) : string
$element Pimcore\Model\Element\ElementInterface $element
return string

getFilename() public static method

public static getFilename ( Pimcore\Model\Element\ElementInterface $element ) : string
$element Pimcore\Model\Element\ElementInterface
return string

getIdList() public static method

public static getIdList ( $list, $idGetter = 'getId' ) : array
$list array | \Pimcore\Model\Listing\AbstractListing
return array

getIdPath() public static method

public static getIdPath ( $element ) : string
$element
return string

getRequiredByDependenciesForFrontend() public static method

public static getRequiredByDependenciesForFrontend ( Dependency $d ) : array
$d Pimcore\Model\Dependency
return array

getRequiresDependenciesForFrontend() public static method

public static getRequiresDependenciesForFrontend ( Dependency $d ) : array
$d Pimcore\Model\Dependency
return array

getSafeVersionInfo() public static method

public static getSafeVersionInfo ( $versions )

getSaveCopyName() public static method

Returns a uniqe key for the element in the $target-Path (recursive)
public static getSaveCopyName ( string $type, string $sourceKey, Pimcore\Model\Element\ElementInterface $target ) : Pimcore\Model\Element\ElementInterface | string
$type string
$sourceKey string
$target Pimcore\Model\Element\ElementInterface
return Pimcore\Model\Element\ElementInterface | string

getType() public static method

determines the type of an element (object,asset,document)
public static getType ( Pimcore\Model\Element\ElementInterface $element ) : string
$element Pimcore\Model\Element\ElementInterface
return string

getTypePath() public static method

public static getTypePath ( $element ) : string
$element
return string

getUniqueKey() public static method

returns a unique key for an element
public static getUniqueKey ( $element ) : string
$element
return string

getValidKey() public static method

public static getValidKey ( $key, null $type ) : mixed | string
$key
$type null
return mixed | string

gridElementData() public static method

public static gridElementData ( Pimcore\Model\Element\ElementInterface $element ) : array
$element Pimcore\Model\Element\ElementInterface
return array

isPublished() public static method

determines whether an element is published
public static isPublished ( Pimcore\Model\Element\ElementInterface $element = null ) : boolean
$element Pimcore\Model\Element\ElementInterface
return boolean

isValidKey() public static method

public static isValidKey ( $key, $type ) : boolean
$key
$type
return boolean

loadAllFields() public static method

public static loadAllFields ( Pimcore\Model\Element\ElementInterface $element ) : Pimcore\Model\Element\ElementInterface
$element Pimcore\Model\Element\ElementInterface
return Pimcore\Model\Element\ElementInterface

minimizePropertiesForEditmode() public static method

public static minimizePropertiesForEditmode ( $props ) : array
$props
return array

pathExists() public static method

public static pathExists ( $path, $type = null ) : boolean
$path
$type
return boolean

performSanityCheck() protected static method

protected static performSanityCheck ( Pimcore\Model\Element\ElementInterface $element ) : void
$element Pimcore\Model\Element\ElementInterface
return void

renewReferences() public static method

renews all references, for example after unserializing an ElementInterface
public static renewReferences ( Document | Asset | AbstractObject $data, $initial = true ) : mixed
$data Pimcore\Model\Document | Pimcore\Model\Asset | Pimcore\Model\Object\AbstractObject
return mixed

runSanityCheck() public static method

public static runSanityCheck ( )

scheduleForSanityCheck() public static method

Schedules element with this id for sanity check to be cleaned of broken relations
public static scheduleForSanityCheck ( Pimcore\Model\Element\ElementInterface $element ) : void
$element Pimcore\Model\Element\ElementInterface
return void

updateChilds() protected method

protected updateChilds ( Pimcore\Model\Element\ElementInterface $target, Pimcore\Model\Element\ElementInterface $new ) : void
$target Pimcore\Model\Element\ElementInterface the parent element
$new Pimcore\Model\Element\ElementInterface the newly inserted child
return void