PHP Class Sulu\Bundle\ResourceBundle\Resource\FilterManager

Inheritance: implements Sulu\Bundle\ResourceBundle\Resource\FilterManagerInterface, use trait Sulu\Component\Persistence\RelationTrait
Show file Open project: sulu/sulu

Protected Properties

Property Type Description
$conditionEntityName
$conditionGroupEntityName
$conditionRepository Sulu\Bundle\ResourceBundle\Entity\ConditionRepositoryInterface
$contextConfiguration array
$em Doctrine\ORM\EntityManagerInterface
$filterEntityName
$filterRepository Sulu\Bundle\ResourceBundle\Entity\FilterRepositoryInterface
$filterTranslationEntityName
$userEntityName
$userRepository Sulu\Component\Security\Authentication\UserRepositoryInterface

Public Methods

Method Description
__construct ( Doctrine\ORM\EntityManagerInterface $em, Sulu\Bundle\ResourceBundle\Entity\FilterRepositoryInterface $filterRepo, Sulu\Component\Security\Authentication\UserRepositoryInterface $userRepository, Sulu\Bundle\ResourceBundle\Entity\ConditionRepositoryInterface $conditionRepository, array $contextConfig )
batchDelete ( array $ids ) Deletes multiple filters at once.
delete ( $id )
findByIdAndLocale ( $id, $locale )
findFiltersForUserAndContext ( string $context, $userId, string $locale ) : Filter[] Finds all filters filtered by context and user and for the given locale.
getFeaturesForContext ( $context ) : array | null Returns the configured features for a context.
getFieldDescriptors ( $locale )
getListFieldDescriptors ( $locale )
hasContext ( $context ) : boolean Checks if the context exists.
isFeatureEnabled ( $context, $feature ) : boolean Checks if a feature is enabled for a context.
save ( array $data, $locale, $userId, $id = null )

Protected Methods

Method Description
addConditionGroup ( Filter $filter, array $conditionGroupData ) : boolean Adds a condition group to the given filter.
checkData ( array $data, boolean $create ) Checks if the given data is correct.
checkDataSet ( array $data, string $key, boolean $create ) : boolean Checks if data for the given key is set correctly.
getProperty ( array $data, string $key, string $default = null ) : mixed Returns the entry from the data with the given key, or the given default value, if the key does not exist.
getValueForCondition ( $value, $type ) : string Parses the value for a condition - is mainly used for parsing values with type datetime but excludes relative values like "-1 week" or "now".
isValidConditionData ( array $data ) : boolean Checks if the given data is correct for a condition.
removeNonExistentConditions ( ConditionGroup $conditionGroup, array $conditionIds ) Removes conditions from condition groups when they are not in the given array.
updateConditionGroup ( ConditionGroup $conditionGroup, array $matchedEntry ) : boolean Updates the given condition group with the values from the given array.

Method Details

__construct() public method

public __construct ( Doctrine\ORM\EntityManagerInterface $em, Sulu\Bundle\ResourceBundle\Entity\FilterRepositoryInterface $filterRepo, Sulu\Component\Security\Authentication\UserRepositoryInterface $userRepository, Sulu\Bundle\ResourceBundle\Entity\ConditionRepositoryInterface $conditionRepository, array $contextConfig )
$em Doctrine\ORM\EntityManagerInterface
$filterRepo Sulu\Bundle\ResourceBundle\Entity\FilterRepositoryInterface
$userRepository Sulu\Component\Security\Authentication\UserRepositoryInterface
$conditionRepository Sulu\Bundle\ResourceBundle\Entity\ConditionRepositoryInterface
$contextConfig array

addConditionGroup() protected method

Adds a condition group to the given filter.
protected addConditionGroup ( Filter $filter, array $conditionGroupData ) : boolean
$filter Sulu\Bundle\ResourceBundle\Api\Filter The filter to add the condition group to
$conditionGroupData array The array containing the data for the additional condition group
return boolean

batchDelete() public method

Deletes multiple filters at once.
public batchDelete ( array $ids )
$ids array

checkData() protected method

Checks if the given data is correct.
protected checkData ( array $data, boolean $create )
$data array The data to check
$create boolean Defines if check is for new or already existing data

checkDataSet() protected method

Checks if data for the given key is set correctly.
protected checkDataSet ( array $data, string $key, boolean $create ) : boolean
$data array The array with the data
$key string The array key to check
$create boolean Defines if the is for new or already existing data
return boolean

delete() public method

public delete ( $id )

findByIdAndLocale() public method

public findByIdAndLocale ( $id, $locale )

findFiltersForUserAndContext() public method

Finds all filters filtered by context and user and for the given locale.
public findFiltersForUserAndContext ( string $context, $userId, string $locale ) : Filter[]
$context string
$userId
$locale string
return Sulu\Bundle\ResourceBundle\Api\Filter[]

getFeaturesForContext() public method

Returns the configured features for a context.
public getFeaturesForContext ( $context ) : array | null
$context
return array | null

getFieldDescriptors() public method

public getFieldDescriptors ( $locale )

getListFieldDescriptors() public method

public getListFieldDescriptors ( $locale )

getProperty() protected method

Returns the entry from the data with the given key, or the given default value, if the key does not exist.
protected getProperty ( array $data, string $key, string $default = null ) : mixed
$data array
$key string
$default string
return mixed

getValueForCondition() protected method

Parses the value for a condition - is mainly used for parsing values with type datetime but excludes relative values like "-1 week" or "now".
protected getValueForCondition ( $value, $type ) : string
return string

hasContext() public method

Checks if the context exists.
public hasContext ( $context ) : boolean
$context
return boolean

isFeatureEnabled() public method

Checks if a feature is enabled for a context.
public isFeatureEnabled ( $context, $feature ) : boolean
$context
$feature
return boolean

isValidConditionData() protected method

Checks if the given data is correct for a condition.
protected isValidConditionData ( array $data ) : boolean
$data array The data to check
return boolean

removeNonExistentConditions() protected method

Removes conditions from condition groups when they are not in the given array.
protected removeNonExistentConditions ( ConditionGroup $conditionGroup, array $conditionIds )
$conditionGroup Sulu\Bundle\ResourceBundle\Entity\ConditionGroup
$conditionIds array

save() public method

public save ( array $data, $locale, $userId, $id = null )
$data array

updateConditionGroup() protected method

Updates the given condition group with the values from the given array.
protected updateConditionGroup ( ConditionGroup $conditionGroup, array $matchedEntry ) : boolean
$conditionGroup Sulu\Bundle\ResourceBundle\Entity\ConditionGroup
$matchedEntry array
return boolean

Property Details

$conditionEntityName protected static property

protected static $conditionEntityName

$conditionGroupEntityName protected static property

protected static $conditionGroupEntityName

$conditionRepository protected property

protected ConditionRepositoryInterface,Sulu\Bundle\ResourceBundle\Entity $conditionRepository
return Sulu\Bundle\ResourceBundle\Entity\ConditionRepositoryInterface

$contextConfiguration protected property

protected array $contextConfiguration
return array

$em protected property

protected EntityManagerInterface,Doctrine\ORM $em
return Doctrine\ORM\EntityManagerInterface

$filterEntityName protected static property

protected static $filterEntityName

$filterRepository protected property

protected FilterRepositoryInterface,Sulu\Bundle\ResourceBundle\Entity $filterRepository
return Sulu\Bundle\ResourceBundle\Entity\FilterRepositoryInterface

$filterTranslationEntityName protected static property

protected static $filterTranslationEntityName

$userEntityName protected static property

protected static $userEntityName

$userRepository protected property

protected UserRepositoryInterface,Sulu\Component\Security\Authentication $userRepository
return Sulu\Component\Security\Authentication\UserRepositoryInterface