FlexDirectory
in package
implements
FlexDirectoryInterface
uses
FlexAuthorizeTrait
Class FlexDirectory
Table of Contents
Interfaces
- FlexDirectoryInterface
- Interface FlexDirectoryInterface
Properties
- $blueprint_file : string
- $blueprints : array<string|int, Blueprint>
- $cache : array<string|int, CacheInterface>
- $collection : FlexCollectionInterface|null
- $collectionClassName : string
- $config : Config
- $defaults : array<string|int, mixed>
- $enabled : bool
- $indexClassName : string
- $indexes : array<string|int, FlexIndexInterface>
- $objectClassName : string
- $objects : array<string|int, FlexObjectInterface>
- $storage : FlexStorageInterface
- $type : string
- $_authorize : string|null
Methods
- __construct() : mixed
- FlexDirectory constructor.
- clearCache() : $this
- createCollection() : FlexCollectionInterface
- createIndex() : FlexIndexInterface
- createObject() : FlexObjectInterface
- getAuthorizeRule() : string
- getBlueprint() : Blueprint
- Returns a new uninitialized instance of blueprint.
- getBlueprintFile() : string
- getCache() : CacheInterface
- getCollection() : FlexCollectionInterface
- Get collection. In the site this will be filtered by the default filters (published etc).
- getCollectionClass() : string
- getConfig() : mixed
- getDescription() : string
- getDirectoryConfigUri() : string
- getFlexType() : string
- getIndex() : FlexIndexInterface
- Get the full collection of all stored objects.
- getIndexClass() : string
- getMediaFolder() : string|null
- getObject() : FlexObjectInterface|null
- Returns an object if it exists. If no arguments are passed (or both of them are null), method creates a new empty object.
- getObjectClass() : string
- getSearchOptions() : array<string|int, mixed>
- getSearchProperties() : array<string|int, mixed>
- getStorage() : FlexStorageInterface
- getStorageFolder() : string|null
- getTitle() : string
- getType() : string
- isAuthorized() : bool|null
- Check if user is authorized for the action.
- isEnabled() : bool
- isListed() : bool
- loadCollection() : FlexCollectionInterface
- reloadIndex() : void
- remove() : FlexObjectInterface|null
- update() : FlexObjectInterface
- createStorage() : FlexStorageInterface
- dynamicAuthorizeField() : void
- dynamicDataField() : void
- dynamicFlexField() : void
- getActiveUser() : UserInterface|null
- getAuthorizeAction() : string
- getAuthorizeScope() : string
- getBlueprintInternal() : Blueprint
- getDirectoryConfig() : array<string|int, mixed>
- isAuthorizedAction() : bool|null
- Check if user is authorized for the action.
- isAuthorizedOverride() : bool|null
- Please override this method
- isAuthorizedSuperAdmin() : bool|null
- loadCachedObjects() : array<string|int, mixed>
- loadIndex() : FlexIndexInterface
- mergeArrays() : array<string|int, mixed>
Properties
$blueprint_file
protected
string
$blueprint_file
$blueprints
protected
array<string|int, Blueprint>
$blueprints
$cache
protected
array<string|int, CacheInterface>
$cache
$collection
protected
FlexCollectionInterface|null
$collection
Tags
$collectionClassName
protected
string
$collectionClassName
$config
protected
Config
$config
$defaults
protected
array<string|int, mixed>
$defaults
$enabled
protected
bool
$enabled
$indexClassName
protected
string
$indexClassName
$indexes
protected
array<string|int, FlexIndexInterface>
$indexes
= []
Tags
$objectClassName
protected
string
$objectClassName
$objects
protected
array<string|int, FlexObjectInterface>
$objects
$storage
protected
FlexStorageInterface
$storage
$type
protected
string
$type
$_authorize
private
string|null
$_authorize
Methods
__construct()
FlexDirectory constructor.
public
__construct(string $type, string $blueprint_file[, array<string|int, mixed> $defaults = [] ]) : mixed
Parameters
- $type : string
- $blueprint_file : string
- $defaults : array<string|int, mixed> = []
clearCache()
public
clearCache() : $this
Return values
$thiscreateCollection()
public
createCollection(array<string|int, mixed> $entries[, string|null $keyField = null ]) : FlexCollectionInterface
Parameters
- $entries : array<string|int, mixed>
- $keyField : string|null = null
Tags
Return values
FlexCollectionInterfacecreateIndex()
public
createIndex(array<string|int, mixed> $entries[, string|null $keyField = null ]) : FlexIndexInterface
Parameters
- $entries : array<string|int, mixed>
- $keyField : string|null = null
Tags
Return values
FlexIndexInterfacecreateObject()
public
createObject(array<string|int, mixed> $data[, string $key = '' ][, bool $validate = false ]) : FlexObjectInterface
Parameters
- $data : array<string|int, mixed>
- $key : string = ''
- $validate : bool = false
Return values
FlexObjectInterfacegetAuthorizeRule()
public
getAuthorizeRule(string $scope, string $action) : string
Parameters
- $scope : string
- $action : string
Return values
stringgetBlueprint()
Returns a new uninitialized instance of blueprint.
public
getBlueprint([string $type = '' ][, string $context = '' ]) : Blueprint
Always use $object->getBlueprint() or $object->getForm()->getBlueprint() instead.
Parameters
- $type : string = ''
- $context : string = ''
Return values
BlueprintgetBlueprintFile()
public
getBlueprintFile([string $view = '' ]) : string
Parameters
- $view : string = ''
Return values
stringgetCache()
public
getCache([string|null $namespace = null ]) : CacheInterface
Parameters
- $namespace : string|null = null
Return values
CacheInterfacegetCollection()
Get collection. In the site this will be filtered by the default filters (published etc).
public
getCollection([array<string|int, mixed>|null $keys = null ][, string|null $keyField = null ]) : FlexCollectionInterface
Use $directory->getIndex() if you want unfiltered collection.
Parameters
- $keys : array<string|int, mixed>|null = null
-
Array of keys.
- $keyField : string|null = null
-
Field to be used as the key.
Tags
Return values
FlexCollectionInterfacegetCollectionClass()
public
getCollectionClass() : string
Return values
stringgetConfig()
public
getConfig([string|null $name = null ][, mixed $default = null ]) : mixed
Parameters
- $name : string|null = null
- $default : mixed = null
getDescription()
public
getDescription() : string
Return values
stringgetDirectoryConfigUri()
public
getDirectoryConfigUri([string|null $name = null ]) : string
Parameters
- $name : string|null = null
Return values
stringgetFlexType()
public
getFlexType() : string
Return values
stringgetIndex()
Get the full collection of all stored objects.
public
getIndex([array<string|int, mixed>|null $keys = null ][, string|null $keyField = null ]) : FlexIndexInterface
Use $directory->getCollection() if you want a filtered collection.
Parameters
- $keys : array<string|int, mixed>|null = null
-
Array of keys.
- $keyField : string|null = null
-
Field to be used as the key.
Tags
Return values
FlexIndexInterfacegetIndexClass()
public
getIndexClass() : string
Return values
stringgetMediaFolder()
public
getMediaFolder([string|null $key = null ]) : string|null
Parameters
- $key : string|null = null
Return values
string|nullgetObject()
Returns an object if it exists. If no arguments are passed (or both of them are null), method creates a new empty object.
public
getObject([string|null $key = null ][, string|null $keyField = null ]) : FlexObjectInterface|null
Note: It is not safe to use the object without checking if the user can access it.
Parameters
- $key : string|null = null
- $keyField : string|null = null
-
Field to be used as the key.
Return values
FlexObjectInterface|nullgetObjectClass()
public
getObjectClass() : string
Return values
stringgetSearchOptions()
public
getSearchOptions([array<string|int, mixed>|null $options = null ]) : array<string|int, mixed>
Parameters
- $options : array<string|int, mixed>|null = null
Return values
array<string|int, mixed>getSearchProperties()
public
getSearchProperties([string|array<string|int, string>|null $properties = null ]) : array<string|int, mixed>
Parameters
- $properties : string|array<string|int, string>|null = null
Return values
array<string|int, mixed>getStorage()
public
getStorage() : FlexStorageInterface
Return values
FlexStorageInterfacegetStorageFolder()
public
getStorageFolder([string|null $key = null ]) : string|null
Parameters
- $key : string|null = null
Return values
string|nullgetTitle()
public
getTitle() : string
Return values
stringgetType()
public
getType() : string
Use ->getFlexType() method instead.
Return values
stringisAuthorized()
Check if user is authorized for the action.
public
isAuthorized(string $action[, string|null $scope = null ][, UserInterface|null $user = null ]) : bool|null
Note: There are two deny values: denied (false), not set (null). This allows chaining multiple rules together when the previous rules were not matched.
To override the default behavior, please use isAuthorizedOverride().
Parameters
- $action : string
- $scope : string|null = null
- $user : UserInterface|null = null
Tags
Return values
bool|nullisEnabled()
public
isEnabled() : bool
Return values
boolisListed()
public
isListed() : bool
Return values
boolloadCollection()
public
loadCollection(array<string|int, mixed> $entries[, string|null $keyField = null ]) : FlexCollectionInterface
Parameters
- $entries : array<string|int, mixed>
- $keyField : string|null = null
Tags
Return values
FlexCollectionInterfacereloadIndex()
public
reloadIndex() : void
remove()
public
remove(string $key) : FlexObjectInterface|null
Use $object->delete() instead.
Parameters
- $key : string
Return values
FlexObjectInterface|nullupdate()
public
update(array<string|int, mixed> $data[, string|null $key = null ]) : FlexObjectInterface
Use $object->update()->save() instead.
Parameters
- $data : array<string|int, mixed>
- $key : string|null = null
Return values
FlexObjectInterfacecreateStorage()
protected
createStorage() : FlexStorageInterface
Return values
FlexStorageInterfacedynamicAuthorizeField()
protected
dynamicAuthorizeField(array<string|int, mixed> &$field, string $property, array<string|int, mixed> $call) : void
Parameters
- $field : array<string|int, mixed>
- $property : string
- $call : array<string|int, mixed>
dynamicDataField()
protected
dynamicDataField(array<string|int, mixed> &$field, string $property, array<string|int, mixed> $call) : void
Parameters
- $field : array<string|int, mixed>
- $property : string
- $call : array<string|int, mixed>
dynamicFlexField()
protected
dynamicFlexField(array<string|int, mixed> &$field, string $property, array<string|int, mixed> $call) : void
Parameters
- $field : array<string|int, mixed>
- $property : string
- $call : array<string|int, mixed>
getActiveUser()
protected
getActiveUser() : UserInterface|null
Return values
UserInterface|nullgetAuthorizeAction()
protected
getAuthorizeAction(string $action) : string
Parameters
- $action : string
Return values
stringgetAuthorizeScope()
protected
getAuthorizeScope() : string
Return values
stringgetBlueprintInternal()
protected
getBlueprintInternal([string $type_view = '' ][, string $context = '' ]) : Blueprint
Parameters
- $type_view : string = ''
- $context : string = ''
Return values
BlueprintgetDirectoryConfig()
protected
getDirectoryConfig([string|null $name = null ]) : array<string|int, mixed>
Parameters
- $name : string|null = null
Return values
array<string|int, mixed>isAuthorizedAction()
Check if user is authorized for the action.
protected
isAuthorizedAction(UserInterface $user, string $action, string $scope, bool $isMe) : bool|null
Parameters
- $user : UserInterface
- $action : string
- $scope : string
- $isMe : bool
Return values
bool|nullisAuthorizedOverride()
Please override this method
protected
isAuthorizedOverride(UserInterface $user, string $action, string $scope, bool $isMe) : bool|null
Parameters
- $user : UserInterface
- $action : string
- $scope : string
- $isMe : bool
Return values
bool|nullisAuthorizedSuperAdmin()
protected
isAuthorizedSuperAdmin(UserInterface $user) : bool|null
Not needed for Flex Users.
Parameters
- $user : UserInterface
Return values
bool|nullloadCachedObjects()
protected
loadCachedObjects(array<string|int, mixed> $fetch) : array<string|int, mixed>
Parameters
- $fetch : array<string|int, mixed>
Return values
array<string|int, mixed>loadIndex()
protected
loadIndex(string $keyField) : FlexIndexInterface
Parameters
- $keyField : string
Tags
Return values
FlexIndexInterfacemergeArrays()
protected
mergeArrays(array<string|int, mixed> $array1, array<string|int, mixed> $array2) : array<string|int, mixed>
Parameters
- $array1 : array<string|int, mixed>
- $array2 : array<string|int, mixed>