core/model/modx/modsymlink.class.php
- Package
- modx
\modSymLink
A modResource derivative the represents a symbolic link.
This is the basis for the entire xPDO object model, and can also be used by a class generator {@link xPDOGenerator}, ultimately allowing custom classes to be user-defined in a web interface and framework-generated at runtime.
- Parent(s)
- \modResourceInterface < \modResourceInterface < \modAccessibleObject < \xPDOObject
- Children
- \modSymLink_mysql
- \modSymLink_sqlsrv
- Extends
- modResource
Properties
array
$_aggregates= 'array ()'
An array of aggregate foreign key relationships for the class.
Inherited from: \xPDOObject::$$_aggregates\modAccessibleObject::$$_aggregates\modAccessibleSimpleObject::$$_aggregates\modResource::$$_aggregatesarray ()
Details- Type
- array
- Access
- public
- Inherited_from
- \xPDOObject::$$_aggregates
- Inherited_from
- \modAccessibleObject::$$_aggregates
- Inherited_from
- \modAccessibleSimpleObject::$$_aggregates
- Inherited_from
- \modResource::$$_aggregates
string
$_alias= 'null'
An alias for this instance of the class.
Inherited from: \xPDOObject::$$_alias\modAccessibleObject::$$_alias\modAccessibleSimpleObject::$$_alias\modResource::$$_aliasnull
Details- Type
- string
- Inherited_from
- \xPDOObject::$$_alias
- Inherited_from
- \modAccessibleObject::$$_alias
- Inherited_from
- \modAccessibleSimpleObject::$$_alias
- Inherited_from
- \modResource::$$_alias
boolean
$_cacheFlag= 'true'
Indicates the cacheability of the instance.
Inherited from: \xPDOObject::$$_cacheFlag\modAccessibleObject::$$_cacheFlag\modAccessibleSimpleObject::$$_cacheFlag\modResource::$$_cacheFlagtrue
Details- Type
- boolean
- Inherited_from
- \xPDOObject::$$_cacheFlag
- Inherited_from
- \modAccessibleObject::$$_cacheFlag
- Inherited_from
- \modAccessibleSimpleObject::$$_cacheFlag
- Inherited_from
- \modResource::$$_cacheFlag
string
$_cacheKey= 'null'
The cache filename for the resource in the context.
Inherited from: \modResource::$$_cacheKeynull
Details- Type
- string
- Inherited_from
- \modResource::$$_cacheKey
string
$_class= 'null'
The actual class name of an instance.
Inherited from: \xPDOObject::$$_class\modAccessibleObject::$$_class\modAccessibleSimpleObject::$$_class\modResource::$$_classnull
Details- Type
- string
- Inherited_from
- \xPDOObject::$$_class
- Inherited_from
- \modAccessibleObject::$$_class
- Inherited_from
- \modAccessibleSimpleObject::$$_class
- Inherited_from
- \modResource::$$_class
array
$_composites= 'array ()'
An array of composite foreign key relationships for the class.
Inherited from: \xPDOObject::$$_composites\modAccessibleObject::$$_composites\modAccessibleSimpleObject::$$_composites\modResource::$$_compositesarray ()
Details- Type
- array
- Access
- public
- Inherited_from
- \xPDOObject::$$_composites
- Inherited_from
- \modAccessibleObject::$$_composites
- Inherited_from
- \modAccessibleSimpleObject::$$_composites
- Inherited_from
- \modResource::$$_composites
string
$_content= ''''
Note that this is not the raw source content, but the content that is the result of processing cacheable tags within the raw source content.
''
Details- Type
- string
- Inherited_from
- \modResource::$$_content
string
$_contextKey= 'null'
Note that this is different than the context_key field that describes a primary context for the resource.
null
Details- Type
- string
- Inherited_from
- \modResource::$$_contextKey
array
$_dirty= 'array ()'
An array of field names that have been modified.
Inherited from: \xPDOObject::$$_dirty\modAccessibleObject::$$_dirty\modAccessibleSimpleObject::$$_dirty\modResource::$$_dirtyarray ()
Details- Type
- array
- Access
- public
- Inherited_from
- \xPDOObject::$$_dirty
- Inherited_from
- \modAccessibleObject::$$_dirty
- Inherited_from
- \modAccessibleSimpleObject::$$_dirty
- Inherited_from
- \modResource::$$_dirty
array
$_fieldAliases= 'array()'
An optional array of field aliases.
Inherited from: \xPDOObject::$$_fieldAliases\modAccessibleObject::$$_fieldAliases\modAccessibleSimpleObject::$$_fieldAliases\modResource::$$_fieldAliasesarray()
Details- Type
- array
- Inherited_from
- \xPDOObject::$$_fieldAliases
- Inherited_from
- \modAccessibleObject::$$_fieldAliases
- Inherited_from
- \modAccessibleSimpleObject::$$_fieldAliases
- Inherited_from
- \modResource::$$_fieldAliases
array
$_fieldMeta= 'array ()'
An array of metadata definitions for each field in the class.
Inherited from: \xPDOObject::$$_fieldMeta\modAccessibleObject::$$_fieldMeta\modAccessibleSimpleObject::$$_fieldMeta\modResource::$$_fieldMetaarray ()
Details- Type
- array
- Access
- public
- Inherited_from
- \xPDOObject::$$_fieldMeta
- Inherited_from
- \modAccessibleObject::$$_fieldMeta
- Inherited_from
- \modAccessibleSimpleObject::$$_fieldMeta
- Inherited_from
- \modResource::$$_fieldMeta
array
$_fields= 'array ()'
An array of key-value pairs representing the fields of the instance.
Inherited from: \xPDOObject::$$_fields\modAccessibleObject::$$_fields\modAccessibleSimpleObject::$$_fields\modResource::$$_fieldsarray ()
Details- Type
- array
- Access
- public
- Inherited_from
- \xPDOObject::$$_fields
- Inherited_from
- \modAccessibleObject::$$_fields
- Inherited_from
- \modAccessibleSimpleObject::$$_fields
- Inherited_from
- \modResource::$$_fields
boolean
$_isForward= 'false'
Indicates if this Resource was generated from a forward.
Inherited from: \modResource::$$_isForwardfalse
Details- Type
- boolean
- Inherited_from
- \modResource::$$_isForward
array
$_jscripts= 'array()'
An array of Javascript/CSS to be appended to the footer of this Resource
Inherited from: \modResource::$$_jscriptsarray()
Details- Type
- array
- Inherited_from
- \modResource::$$_jscripts
array
$_lazy= 'array ()'
An array of field names that have not been loaded from the source.
Inherited from: \xPDOObject::$$_lazy\modAccessibleObject::$$_lazy\modAccessibleSimpleObject::$$_lazy\modResource::$$_lazyarray ()
Details- Type
- array
- Access
- public
- Inherited_from
- \xPDOObject::$$_lazy
- Inherited_from
- \modAccessibleObject::$$_lazy
- Inherited_from
- \modAccessibleSimpleObject::$$_lazy
- Inherited_from
- \modResource::$$_lazy
array
$_loadedjscripts= 'array()'
All loaded Javascript/CSS that has been calculated to be loaded
Inherited from: \modResource::$$_loadedjscriptsarray()
Details- Type
- array
- Inherited_from
- \modResource::$$_loadedjscripts
boolean
$_new= 'true'
Indicates if the instance is transient (and thus new).
Inherited from: \xPDOObject::$$_new\modAccessibleObject::$$_new\modAccessibleSimpleObject::$$_new\modResource::$$_newtrue
Details- Type
- boolean
- Access
- public
- Inherited_from
- \xPDOObject::$$_new
- Inherited_from
- \modAccessibleObject::$$_new
- Inherited_from
- \modAccessibleSimpleObject::$$_new
- Inherited_from
- \modResource::$$_new
array
$_options= 'array()'
A collection of various options that can be used on the instance.
Inherited from: \xPDOObject::$$_options\modAccessibleObject::$$_options\modAccessibleSimpleObject::$$_options\modResource::$$_optionsarray()
Details- Type
- array
- Inherited_from
- \xPDOObject::$$_options
- Inherited_from
- \modAccessibleObject::$$_options
- Inherited_from
- \modAccessibleSimpleObject::$$_options
- Inherited_from
- \modResource::$$_options
string
$_package= 'null'
The package the class is a part of.
Inherited from: \xPDOObject::$$_package\modAccessibleObject::$$_package\modAccessibleSimpleObject::$$_package\modResource::$$_packagenull
Details- Type
- string
- Inherited_from
- \xPDOObject::$$_package
- Inherited_from
- \modAccessibleObject::$$_package
- Inherited_from
- \modAccessibleSimpleObject::$$_package
- Inherited_from
- \modResource::$$_package
string|array
$_pk= 'null'
The primary key field (or an array of primary key fields) for this object.
Inherited from: \xPDOObject::$$_pk\modAccessibleObject::$$_pk\modAccessibleSimpleObject::$$_pk\modResource::$$_pknull
Details- Type
- string | array
- Access
- public
- Inherited_from
- \xPDOObject::$$_pk
- Inherited_from
- \modAccessibleObject::$$_pk
- Inherited_from
- \modAccessibleSimpleObject::$$_pk
- Inherited_from
- \modResource::$$_pk
string|array
$_pktype= 'null'
The php native type of the primary key field.
Inherited from: \xPDOObject::$$_pktype\modAccessibleObject::$$_pktype\modAccessibleSimpleObject::$$_pktype\modResource::$$_pktypeNOTE: Will be an array if multiple primary keys are specified for the object.
null
Details- Type
- string | array
- Access
- public
- Inherited_from
- \xPDOObject::$$_pktype
- Inherited_from
- \modAccessibleObject::$$_pktype
- Inherited_from
- \modAccessibleSimpleObject::$$_pktype
- Inherited_from
- \modResource::$$_pktype
array
$_policies= 'array()'
A local cache of access policies for the instance.
Inherited from: \modAccessibleObject::$$_policies\modAccessibleSimpleObject::$$_policies\modResource::$$_policiesarray()
Details- Type
- array
- Inherited_from
- \modAccessibleObject::$$_policies
- Inherited_from
- \modAccessibleSimpleObject::$$_policies
- Inherited_from
- \modResource::$$_policies
boolean
$_processed= 'false'
Indicates if the resource has already been processed.
Inherited from: \modResource::$$_processedfalse
Details- Type
- boolean
- Inherited_from
- \modResource::$$_processed
boolean
$_refreshCache= 'true'
Indicates if the site cache should be refreshed when saving changes.
Inherited from: \modResource::$$_refreshCachetrue
Details- Type
- boolean
- Inherited_from
- \modResource::$$_refreshCache
array
$_relatedObjects= 'array ()'
An array of object instances related to this object instance.
Inherited from: \xPDOObject::$$_relatedObjects\modAccessibleObject::$$_relatedObjects\modAccessibleSimpleObject::$$_relatedObjects\modResource::$$_relatedObjectsarray ()
Details- Type
- array
- Access
- public
- Inherited_from
- \xPDOObject::$$_relatedObjects
- Inherited_from
- \modAccessibleObject::$$_relatedObjects
- Inherited_from
- \modAccessibleSimpleObject::$$_relatedObjects
- Inherited_from
- \modResource::$$_relatedObjects
array
$_sjscripts= 'array()'
An array of Javascript/CSS to be appended to the HEAD of this Resource
Inherited from: \modResource::$$_sjscriptsarray()
Details- Type
- array
- Inherited_from
- \modResource::$$_sjscripts
string
$_table= 'null'
Name of the actual table representing this class.
Inherited from: \xPDOObject::$$_table\modAccessibleObject::$$_table\modAccessibleSimpleObject::$$_table\modResource::$$_tablenull
Details- Type
- string
- Access
- public
- Inherited_from
- \xPDOObject::$$_table
- Inherited_from
- \modAccessibleObject::$$_table
- Inherited_from
- \modAccessibleSimpleObject::$$_table
- Inherited_from
- \modResource::$$_table
string
$_tableMeta= 'null'
An array of meta data for the table.
Inherited from: \xPDOObject::$$_tableMeta\modAccessibleObject::$$_tableMeta\modAccessibleSimpleObject::$$_tableMeta\modResource::$$_tableMetanull
Details- Type
- string
- Access
- public
- Inherited_from
- \xPDOObject::$$_tableMeta
- Inherited_from
- \modAccessibleObject::$$_tableMeta
- Inherited_from
- \modAccessibleSimpleObject::$$_tableMeta
- Inherited_from
- \modResource::$$_tableMeta
array
$_validated= 'array ()'
An array of field names that have been already validated.
Inherited from: \xPDOObject::$$_validated\modAccessibleObject::$$_validated\modAccessibleSimpleObject::$$_validated\modResource::$$_validatedarray ()
Details- Type
- array
- Access
- public
- Inherited_from
- \xPDOObject::$$_validated
- Inherited_from
- \modAccessibleObject::$$_validated
- Inherited_from
- \modAccessibleSimpleObject::$$_validated
- Inherited_from
- \modResource::$$_validated
boolean
$_validationLoaded= 'false'
Indicates if the validation map has been loaded.
Inherited from: \xPDOObject::$$_validationLoaded\modAccessibleObject::$$_validationLoaded\modAccessibleSimpleObject::$$_validationLoaded\modResource::$$_validationLoadedfalse
Details- Type
- boolean
- Access
- public
- Inherited_from
- \xPDOObject::$$_validationLoaded
- Inherited_from
- \modAccessibleObject::$$_validationLoaded
- Inherited_from
- \modAccessibleSimpleObject::$$_validationLoaded
- Inherited_from
- \modResource::$$_validationLoaded
array
$_validationRules= 'array()'
An array of validation rules for this object instance.
Inherited from: \xPDOObject::$$_validationRules\modAccessibleObject::$$_validationRules\modAccessibleSimpleObject::$$_validationRules\modResource::$$_validationRulesarray()
Details- Type
- array
- Access
- public
- Inherited_from
- \xPDOObject::$$_validationRules
- Inherited_from
- \modAccessibleObject::$$_validationRules
- Inherited_from
- \modAccessibleSimpleObject::$$_validationRules
- Inherited_from
- \modResource::$$_validationRules
\xPDOValidator
$_validator= 'null'
A validator object responsible for this object instance.
Inherited from: \xPDOObject::$$_validator\modAccessibleObject::$$_validator\modAccessibleSimpleObject::$$_validator\modResource::$$_validatornull
Details- Type
- \xPDOValidator
- Access
- public
- Inherited_from
- \xPDOObject::$$_validator
- Inherited_from
- \modAccessibleObject::$$_validator
- Inherited_from
- \modAccessibleSimpleObject::$$_validator
- Inherited_from
- \modResource::$$_validator
boolean
$allowChildrenResources= 'true'
Whether or not to allow creation of children resources in tree. Can be overridden in a derivative Resource class.
Inherited from: \modResource::$$allowChildrenResourcestrue
Details- Type
- boolean
- Inherited_from
- \modResource::$$allowChildrenResources
boolean
$allowListingInClassKeyDropdown= 'true'
Use if extending modResource to state whether or not the derivative class can be listed in the class_key dropdown users can change when editing a resource.
Inherited from: \modResource::$$allowListingInClassKeyDropdowntrue
Details- Type
- boolean
- Inherited_from
- \modResource::$$allowListingInClassKeyDropdown
string
$container= 'null'
Name of the data source container the object belongs to.
Inherited from: \xPDOObject::$$container\modAccessibleObject::$$container\modAccessibleSimpleObject::$$container\modResource::$$containernull
Details- Type
- string
- Access
- public
- Inherited_from
- \xPDOObject::$$container
- Inherited_from
- \modAccessibleObject::$$container
- Inherited_from
- \modAccessibleSimpleObject::$$container
- Inherited_from
- \modResource::$$container
array
$fieldNames= 'null'
Names of the fields in the data table, fully-qualified with a table name.
Inherited from: \xPDOObject::$$fieldNames\modAccessibleObject::$$fieldNames\modAccessibleSimpleObject::$$fieldNames\modResource::$$fieldNamesNOTE: For use in table joins to qualify fields with the same name.
null
Details- Type
- array
- Access
- public
- Inherited_from
- \xPDOObject::$$fieldNames
- Inherited_from
- \modAccessibleObject::$$fieldNames
- Inherited_from
- \modAccessibleSimpleObject::$$fieldNames
- Inherited_from
- \modResource::$$fieldNames
boolean
$showInContextMenu= 'false'
Use if extending modResource to state whether or not to show the extended class in the tree context menu
Inherited from: \modResource::$$showInContextMenufalse
Details- Type
- boolean
- Inherited_from
- \modResource::$$showInContextMenu
Methods
__construct(
\xPDO $xpdo
)
:
\xPDOObject
Overrides modResource::__construct to set the class key for this Resource type
Do not call the constructor directly; see {@link xPDO::newObject()}.
All derivatives of xPDOObject must redeclare this method, and must call the parent method explicitly before any additional logic is executed, e.g.
public function __construct(xPDO & $xpdo) {
parent :: __construct($xpdo);
// Any additional constructor tasks here
}
Name | Type | Description |
---|---|---|
$xpdo | \xPDO | A reference to the xPDO|modX instance |
Type | Description |
---|---|
\xPDOObject |
_getAliases(
string $class, int $limit
=
0
)
:
array
Find aliases for any defined object relations of the specified class.
Inherited from: \xPDOObject::_getAliases()\modAccessibleObject::_getAliases()\modAccessibleSimpleObject::_getAliases()\modResource::_getAliases()Name | Type | Description |
---|---|---|
$class | string | The name of the class to find aliases from. |
$limit | int | An optional limit on the number of aliases to return; default is 0, i.e. no limit. |
Type | Description |
---|---|
array | An array of aliases or an empty array if none are found. |
- Access
- protected
_getDataType(
string $key
)
:
string
Gets the database data type for the specified field.
Inherited from: \xPDOObject::_getDataType()\modAccessibleObject::_getDataType()\modAccessibleSimpleObject::_getDataType()\modResource::_getDataType()Name | Type | Description |
---|---|---|
$key | string | The field name to get the data type for. |
Type | Description |
---|---|
string | The DB data type of the field. |
- Access
- protected
_getPHPType(
string $key
)
:
string
Gets the php data type for the specified field.
Inherited from: \xPDOObject::_getPHPType()\modAccessibleObject::_getPHPType()\modAccessibleSimpleObject::_getPHPType()\modResource::_getPHPType()Name | Type | Description |
---|---|---|
$key | string | The field name to get the data type for. |
Type | Description |
---|---|
string | The PHP data type of the field. |
- Access
- protected
_getRelatedObjectsByFK(
string $alias, mixed $criteria
=
null, boolean | integer $cacheFlag
=
true
)
:
array
Gets related objects by a foreign key and specified criteria.
Inherited from: \xPDOObject::_getRelatedObjectsByFK()\modAccessibleObject::_getRelatedObjectsByFK()\modAccessibleSimpleObject::_getRelatedObjectsByFK()\modResource::_getRelatedObjectsByFK()Name | Type | Description |
---|---|---|
$alias | string | The alias representing the relationship. |
$criteria | mixed | An optional xPDO criteria expression. |
$cacheFlag | boolean | integer | Indicates if the saved object(s) should be cached and optionally, by specifying an integer value, for how many seconds before expiring. Overrides the cacheFlag for the object. |
Type | Description |
---|---|
array | A collection of objects matching the criteria. |
- Access
- protected
_initFields(
)
:
void
Initializes the field names with the qualified table name.
Inherited from: \xPDOObject::_initFields()\modAccessibleObject::_initFields()\modAccessibleSimpleObject::_initFields()\modResource::_initFields()Once this is called, you can lookup the qualified name by the field name itself in {@link xPDOObject::$fieldNames}.
- Access
- protected
_loadCollectionInstance(
\xPDO $xpdo, array $objCollection, string $className, mixed $criteria, $row, $fromCache, boolean | integer $cacheFlag
=
true
)
:
void
Custom instance loader for collections that respects policy checking.
Inherited from: \modAccessibleObject::_loadCollectionInstance()\modAccessibleSimpleObject::_loadCollectionInstance()\modResource::_loadCollectionInstance()Name | Type | Description |
---|---|---|
$xpdo | \xPDO | &$xpdo A valid xPDO instance. |
$objCollection | array | &$objCollection The collection to load the instance into. |
$className | string | Name of the class. |
$criteria | mixed | A valid primary key, criteria array, or xPDOCriteria instance. |
$row | ||
$fromCache | ||
$cacheFlag | boolean | integer | Indicates if the objects should be cached and optionally, by specifying an integer value, for how many seconds. |
_loadFieldData(
string | array $fields
)
:
void
Load persistent data from the source for the field(s) indicated.
Inherited from: \xPDOObject::_loadFieldData()\modAccessibleObject::_loadFieldData()\modAccessibleSimpleObject::_loadFieldData()\modResource::_loadFieldData()Name | Type | Description |
---|---|---|
$fields | string | array | A field name or array of field names to load from the data source. |
- Access
- protected
_loadInstance(
\xPDO | \modX $xpdo, string $className, mixed $criteria, int $row
)
:
\modAccessibleObject | null
Custom instance from row loader that respects policy checking
Inherited from: \modAccessibleObject::_loadInstance()\modAccessibleSimpleObject::_loadInstance()\modResource::_loadInstance()Name | Type | Description |
---|---|---|
$xpdo | \xPDO | \modX | A reference to the xPDO/modX object. |
$className | string | The name of the class by which to grab the instance from |
$criteria | mixed | A criteria to use when grabbing this instance |
$row | int | The row to select |
Type | Description |
---|---|
\modAccessibleObject | null | An instance of the object |
_loadRows(
\xPDO $xpdo, string $className, \xPDOCriteria $criteria
)
:
\PDOStatement
Responsible for loading a result set from the database.
Inherited from: \xPDOObject::_loadRows()\modAccessibleObject::_loadRows()\modAccessibleSimpleObject::_loadRows()\modResource::_loadRows()Name | Type | Description |
---|---|---|
$xpdo | \xPDO | &$xpdo A valid xPDO instance. |
$className | string | Name of the class. |
$criteria | \xPDOCriteria | A valid xPDOCriteria instance. |
Type | Description |
---|---|
\PDOStatement | A reference to a PDOStatement representing the result set. |
- Static
_loadValidation(
boolean $reload
=
false
)
:
void
Used to load validation from the object map.
Inherited from: \xPDOObject::_loadValidation()\modAccessibleObject::_loadValidation()\modAccessibleSimpleObject::_loadValidation()\modResource::_loadValidation()Name | Type | Description |
---|---|---|
$reload | boolean | Indicates if the schema validation rules should be reloaded. |
- Access
- public
_saveRelatedObject(
\xPDOObject $obj, array $fkMeta
)
:
boolean
Save a related object with pending changes.
Inherited from: \xPDOObject::_saveRelatedObject()\modAccessibleObject::_saveRelatedObject()\modAccessibleSimpleObject::_saveRelatedObject()\modResource::_saveRelatedObject()This function is also responsible for setting foreign keys when new related objects are being saved, as well as local keys when the host object is new and needs the foreign key.
Name | Type | Description |
---|---|---|
$obj | \xPDOObject | &$obj A reference to the related object. |
$fkMeta | array | The meta data representing the relation. |
Type | Description |
---|---|
boolean | True if a related object was dirty and saved successfully. |
- Access
- protected
_saveRelatedObjects(
)
:
integer
Searches for any related objects with pending changes to save.
Inherited from: \xPDOObject::_saveRelatedObjects()\modAccessibleObject::_saveRelatedObjects()\modAccessibleSimpleObject::_saveRelatedObjects()\modResource::_saveRelatedObjects()Type | Description |
---|---|
integer | The number of related objects processed. |
- Access
- protected
- Uses
- \xPDOObject::_saveRelatedObject()
_setRaw(
string $key, mixed $val
)
:
boolean
Set a raw value on a field converted to the appropriate type.
Inherited from: \xPDOObject::_setRaw()\modAccessibleObject::_setRaw()\modAccessibleSimpleObject::_setRaw()\modResource::_setRaw()Name | Type | Description |
---|---|---|
$key | string | The key identifying the field to set. |
$val | mixed | The value to set. |
Type | Description |
---|---|
boolean | Returns true if the value was set, false otherwise. |
- Access
- protected
addFieldAlias(
string $field, string $alias
)
:
bool
Add an alias as a reference to an actual field of the object.
Inherited from: \xPDOObject::addFieldAlias()\modAccessibleObject::addFieldAlias()\modAccessibleSimpleObject::addFieldAlias()\modResource::addFieldAlias()Name | Type | Description |
---|---|---|
$field | string | The field name to create a reference to. |
$alias | string | The name of the reference. |
Type | Description |
---|---|
bool | True if the reference is added successfully. |
addLock(
integer $user
=
0, array $options
=
array()
)
:
boolean
Name | Type | Description |
---|---|---|
$user | integer | |
$options | array | An array of options for the lock. |
Type | Description |
---|---|
boolean | True if the lock was successful. |
- Access
- public
addMany(
mixed $obj, string $alias
=
''
)
:
boolean
Adds an object or collection of objects related to this class.
Inherited from: \xPDOObject::addMany()\modAccessibleObject::addMany()\modAccessibleSimpleObject::addMany()\modResource::addMany()This method adds an object or collection of objects in a one-to- many foreign key relationship with this object to the internal list of related objects. By adding these related objects, you can cascade {@link xPDOObject::save()}, {@link xPDOObject::remove()}, and other operations based on the type of relationships defined.
Name | Type | Description |
---|---|---|
$obj | mixed | &$obj A single object or collection of objects to be related to this instance via the intersection class. |
$alias | string | An optional alias, required only for instances where you have more than one relation defined to the same class. |
Type | Description |
---|---|
boolean | Indicates if the addMany was successful. |
addOne(
\xPDOObject $obj, string $alias
=
''
)
:
boolean
Adds an object related to this modResource by a foreign key relationship.
Inherited from: \modResource::addOne()Adds legacy support for keeping the existing contentType field in sync when a modContentType is set using this function.
Name | Type | Description |
---|---|---|
$obj | \xPDOObject | |
$alias | string |
Type | Description |
---|---|
boolean |
addValidationRule(
string $field, string $name, string $type, string $rule, array $parameters
=
array()
)
:
void
Add a validation rule to an object field for this instance.
Inherited from: \xPDOObject::addValidationRule()\modAccessibleObject::addValidationRule()\modAccessibleSimpleObject::addValidationRule()\modResource::addValidationRule()Name | Type | Description |
---|---|---|
$field | string | The field key to apply the rule to. |
$name | string | A name to identify the rule. |
$type | string | The type of rule. |
$rule | string | The rule definition. |
$parameters | array | Any input parameters for the rule. |
checkPolicy(
array $criteria, string | array $targets
=
null
)
:
boolean
Determine if the current user attributes satisfy the object policy.
Inherited from: \modAccessibleObject::checkPolicy()\modAccessibleSimpleObject::checkPolicy()\modResource::checkPolicy()Name | Type | Description |
---|---|---|
$criteria | array | An associative array providing a key and value to search for within the matched policy attributes between policy and principal. |
$targets | string | array | A target modAccess class name or an array of class names to limit the check. In most cases, this does not need to be set; derivatives should typically determine what targets to include in the findPolicy() implementation. |
Type | Description |
---|---|
boolean | Returns true if the policy is satisfied or no policy exists. |
cleanAlias(
string $alias, array $options
=
array()
)
:
string
Transforms a string to form a valid URL representation.
Inherited from: \modResource::cleanAlias()Name | Type | Description |
---|---|---|
$alias | string | A string to transform into a valid URL representation. |
$options | array | Options to append to or override configuration settings. |
Type | Description |
---|---|
string | The transformed string. |
duplicate(
array $options
=
array()
)
:
mixed
Name | Type | Description |
---|---|---|
$options | array | An array of options. |
Type | Description |
---|---|
mixed | Returns either an error message, or the newly created modResource object. |
encode(
string $source, string $type
=
'md5'
)
:
string
Encodes a string using the specified algorithm.
Inherited from: \xPDOObject::encode()\modAccessibleObject::encode()\modAccessibleSimpleObject::encode()\modResource::encode()NOTE: This implementation currently only implements md5. To implement additional algorithms, override this function in your xPDOObject derivative classes.
Name | Type | Description |
---|---|---|
$source | string | The string source to encode. |
$type | string | The type of encoding algorithm to apply, md5 by default. |
Type | Description |
---|---|
string | The encoded string. |
findPolicy(
string $context
=
''
)
:
array
Loads the access control policies applicable to this resource.
Inherited from: \modResource::findPolicy()Name | Type | Description |
---|---|---|
$context | string | A key identifying a specific context to use when searching for the applicable policies. If not provided, the current context is used. |
Type | Description |
---|---|
array | An array of access policies for this object; an empty array is returned if no policies are assigned to the object. |
fromArray(
array $fldarray, string $keyPrefix
=
'', boolean $setPrimaryKeys
=
false, boolean $rawValues
=
false, boolean $adhocValues
=
false
)
:
void
Sets object fields from an associative array of key => value pairs.
Inherited from: \xPDOObject::fromArray()\modAccessibleObject::fromArray()\modAccessibleSimpleObject::fromArray()\modResource::fromArray()Name | Type | Description |
---|---|---|
$fldarray | array | An associative array of key => values. |
$keyPrefix | string | Specify an optional prefix to strip from all array keys in fldarray. |
$setPrimaryKeys | boolean | Optional param to set generated primary keys. |
$rawValues | boolean | Optional way to set values without calling the {@link xPDOObject::set()} method. |
$adhocValues | boolean | Optional way to set adhoc values so that all the values of fldarray become object vars. |
fromJSON(
string $jsonSource, string $keyPrefix
=
'', boolean $setPrimaryKeys
=
false, boolean $rawValues
=
false, boolean $adhocValues
=
false
)
:
void
Sets the object fields from a JSON object string.
Inherited from: \xPDOObject::fromJSON()\modAccessibleObject::fromJSON()\modAccessibleSimpleObject::fromJSON()\modResource::fromJSON()Name | Type | Description |
---|---|---|
$jsonSource | string | A JSON object string. |
$keyPrefix | string | An optional prefix to strip from the keys. |
$setPrimaryKeys | boolean | Indicates if primary key fields should be set. |
$rawValues | boolean | Indicates if values should be set raw or via {@link xPDOObject::set()}. |
$adhocValues | boolean | Indicates if ad hoc fields should be added to the xPDOObject from the source object. |
get(
string | array $k, string | array $format
=
null, mixed $formatTemplate
=
null
)
:
mixed
Get a field value (or a set of values) by the field key(s) or name(s).
Inherited from: \xPDOObject::get()\modAccessibleObject::get()\modAccessibleSimpleObject::get()\modResource::get()Warning: do not use the $format parameter if retrieving multiple values of different types, as the format string will be applied to all types, most likely with unpredicatable results. Optionally, you can supply an associate array of format strings with the field key as the key for the format array.
Name | Type | Description |
---|---|---|
$k | string | array | A string (or an array of strings) representing the field key or name. |
$format | string | array | An optional variable (or an array of variables) to format the return value(s). |
$formatTemplate | mixed | An additional optional variable that can be used in formatting the return value(s). |
Type | Description |
---|---|
mixed | The value(s) of the field(s) requested. |
getAliasPath(
string $alias
=
'', array $fields
=
array()
)
:
string
Name | Type | Description |
---|---|---|
$alias | string | Optional. The alias to check. If not set, will then build it from the pagetitle if automatic_alias is set to true. |
$fields | array | Optional. An array of field values to use instead of using the current modResource fields. |
Type | Description |
---|---|
string |
getCacheKey(
)
:
string
Returns the cache key for this instance in the current context.
Inherited from: \modResource::getCacheKey()Type | Description |
---|---|
string | The cache key. |
getContent(
array $options
=
array()
)
:
string
Gets the raw, unprocessed source content for a resource.
Inherited from: \modResource::getContent()Name | Type | Description |
---|---|---|
$options | array | An array of options implementations can use to accept language, revision identifiers, or other information to alter the behavior of the method. |
Type | Description |
---|---|
string | The raw source content for the resource. |
getContextMenuText(
)
:
array
Use this in your extended Resource class to display the text for the context menu item, if showInContextMenu is set to true.
Type | Description |
---|---|
array |
getControllerPath(
\xPDO $modx
)
:
string
Gets the manager controller path for the Symlink
Name | Type | Description |
---|---|---|
$modx | \xPDO | A reference to the modX instance |
Type | Description |
---|---|
string |
- Static
getFKClass(
string $k
)
:
void
Get the name of a class related by foreign key to a specified field key.
Inherited from: \xPDOObject::getFKClass()\modAccessibleObject::getFKClass()\modAccessibleSimpleObject::getFKClass()\modResource::getFKClass()This is generally used to lookup classes involved in one-to-one relationships with the current object.
Name | Type | Description |
---|---|---|
$k | string | The field name or key to lookup a related class for. |
getFKDefinition(
string $alias
)
:
array
Get a foreign key definition for a specific classname.
Inherited from: \xPDOObject::getFKDefinition()\modAccessibleObject::getFKDefinition()\modAccessibleSimpleObject::getFKDefinition()\modResource::getFKDefinition()This is generally used to lookup classes in a one-to-many relationship with the current object.
Name | Type | Description |
---|---|---|
$alias | string | Alias of the related class to lookup a foreign key definition from. |
Type | Description |
---|---|
array | A foreign key definition. |
getField(
string $key, bool $validate
=
false
)
:
string | bool
Get a field name, looking up any by alias if not an actual field.
Inherited from: \xPDOObject::getField()\modAccessibleObject::getField()\modAccessibleSimpleObject::getField()\modResource::getField()Name | Type | Description |
---|---|---|
$key | string | The field name or alias to translate to the actual field name. |
$validate | bool | If true, the method will return false if the field or an alias of it is not found. Otherwise, the key is returned as passed. |
Type | Description |
---|---|
string | bool | The actual field name, the key as passed, or false if not a field or alias and validate is true. |
getFieldName(
string $k, string $alias
=
null
)
:
string
Gets a field name as represented in the database container.
Inherited from: \xPDOObject::getFieldName()\modAccessibleObject::getFieldName()\modAccessibleSimpleObject::getFieldName()\modResource::getFieldName()This gets the name of the field, fully-qualified by either the object table name or a specified alias, and properly quoted.
Name | Type | Description |
---|---|---|
$k | string | The simple name of the field. |
$alias | string | An optional alias for the table in a specific query. |
Type | Description |
---|---|
string | The name of the field, qualified with the table name or an optional table alias. |
getGraph(
boolean | string | array | integer $graph
=
true, \xPDOCriteria | array | string | integer $criteria
=
null, boolean | integer $cacheFlag
=
true
)
:
array | boolean
Load a graph of related objects to the current object.
Inherited from: \xPDOObject::getGraph()\modAccessibleObject::getGraph()\modAccessibleSimpleObject::getGraph()\modResource::getGraph()Name | Type | Description |
---|---|---|
$graph | boolean | string | array | integer | An option to tell how to deal with related objects. If integer, will traverse related objects up to a $graph level of depth and load them to the object. If an array, will traverse required related object and load them to the object. If true, will traverse the entire graph and append all related objects to the object (default behavior). |
$criteria | \xPDOCriteria | array | string | integer | A valid xPDO criteria representation. |
$cacheFlag | boolean | integer | Indicates if the objects should be cached and optionally, by specifying an integer value, for how many seconds. |
Type | Description |
---|---|
array | boolean | The graph that was loaded or false if nothing was loaded. |
getGroupsList(
array $sort
=
array('id' => 'ASC'), int $limit
=
0, int $offset
=
0
)
:
array
Gets a sortable, limitable collection (and total count) of Resource Groups for the Resource.
Inherited from: \modResource::getGroupsList()Name | Type | Description |
---|---|---|
$sort | array | An array of sort columns in column => direction format. |
$limit | int | A limit of records to retrieve in the collection. |
$offset | int | A record offset for a limited collection. |
Type | Description |
---|---|
array | An array containing the collection and total. |
getIterator(
string $alias, null | array | \xPDOCriteria $criteria
=
null, bool | int $cacheFlag
=
true
)
:
bool | \xPDOIterator
Get an xPDOIterator for a collection of objects related by aggregate or composite relations.
Inherited from: \xPDOObject::getIterator()\modAccessibleObject::getIterator()\modAccessibleSimpleObject::getIterator()\modResource::getIterator()Name | Type | Description |
---|---|---|
$alias | string | The alias of the relation. |
$criteria | null | array | \xPDOCriteria | A valid xPDO criteria expression. |
$cacheFlag | bool | int | Indicates if the objects should be cached and optionally, by specifying an integer values, for how many seconds. |
Type | Description |
---|---|
bool | \xPDOIterator | An iterator for the collection or false if no relation is found. |
getMany(
string $alias, object $criteria
=
null, boolean | integer $cacheFlag
=
false
)
:
array
Gets a collection of objects related by aggregate or composite relations.
Inherited from: \modResource::getMany()Includes special handling for related objects with alias {@link modTemplateVar}, respecting framework security unless specific criteria are provided.
Name | Type | Description |
---|---|---|
$alias | string | Alias of the foreign class representing the related object. |
$criteria | object | xPDOCriteria object to get the related objects |
$cacheFlag | boolean | integer | Indicates if the objects should be cached and optionally, by specifying an integer value, for how many seconds. |
Type | Description |
---|---|
array | A collection of related objects or an empty array. |
getOne(
string $alias, object $criteria
=
null, boolean | integer $cacheFlag
=
true
)
:
\xPDOObject | null
Gets an object related to this instance by a foreign key relationship.
Inherited from: \xPDOObject::getOne()\modAccessibleObject::getOne()\modAccessibleSimpleObject::getOne()\modResource::getOne()Use this for 1:? (one:zero-or-one) or 1:1 relationships, which you can distinguish by setting the nullability of the field representing the foreign key.
For all 1:* relationships for this instance, see {@link getMany()}.
Name | Type | Description |
---|---|---|
$alias | string | Alias of the foreign class representing the related object. |
$criteria | object | xPDOCriteria object to get the related objects |
$cacheFlag | boolean | integer | Indicates if the object should be cached and optionally, by specifying an integer value, for how many seconds. |
Type | Description |
---|---|
\xPDOObject | null | The related object or null if no instance exists. |
getOption(
string $key, array | null $options
=
null, mixed $default
=
null
)
:
mixed
Get an option value for this instance.
Inherited from: \xPDOObject::getOption()\modAccessibleObject::getOption()\modAccessibleSimpleObject::getOption()\modResource::getOption()Name | Type | Description |
---|---|---|
$key | string | The option key to retrieve a value for. |
$options | array | null | An optional array to search for a value in first. |
$default | mixed | A default value to return if no value is found; null is the default. |
Type | Description |
---|---|
mixed | The value of the option or the provided default if it is not set. |
getPK(
)
:
mixed
Gets the name (or names) of the primary key field(s) for the object.
Inherited from: \xPDOObject::getPK()\modAccessibleObject::getPK()\modAccessibleSimpleObject::getPK()\modResource::getPK()Type | Description |
---|---|
mixed | The string (or an array of strings) representing the name(s) of the primary key field(s) for this instance. |
getPKType(
)
:
string
Gets the type of the primary key field for the object.
Inherited from: \xPDOObject::getPKType()\modAccessibleObject::getPKType()\modAccessibleSimpleObject::getPKType()\modResource::getPKType()Type | Description |
---|---|
string | The type of the primary key field for this instance. |
getPolicies(
)
:
array
Return the currently loaded array of policies.
Inherited from: \modAccessibleObject::getPolicies()\modAccessibleSimpleObject::getPolicies()\modResource::getPolicies()Type | Description |
---|---|
array |
getPrimaryKey(
boolean $validateCompound
=
true
)
:
mixed
Gets the value (or values) of the primary key field(s) for the object.
Inherited from: \xPDOObject::getPrimaryKey()\modAccessibleObject::getPrimaryKey()\modAccessibleSimpleObject::getPrimaryKey()\modResource::getPrimaryKey()Name | Type | Description |
---|---|---|
$validateCompound | boolean | If any of the keys in a compound primary key are empty or null, and the default value is not allowed to be null, do not return an array, instead return null; the default is true |
Type | Description |
---|---|
mixed | The string (or an array) representing the value(s) of the primary key field(s) for this instance. |
getProcessed(
)
:
boolean
Return whether or not the resource has been processed.
Inherited from: \modResource::getProcessed()Type | Description |
---|---|
boolean |
- Access
- public
getProperties(
string $namespace
=
'core'
)
:
array
Get the properties for the specific namespace for the Resource
Inherited from: \modResource::getProperties()Name | Type | Description |
---|---|---|
$namespace | string |
Type | Description |
---|---|
array |
getProperty(
string $key, string $namespace
=
'core', null $default
=
null
)
:
null
Name | Type | Description |
---|---|---|
$key | string | |
$namespace | string | |
$default | null |
Type | Description |
---|---|
null |
getResourceTypeName(
)
:
string
Use this in your extended Resource class to return a translatable name for the Resource Type.
Type | Description |
---|---|
string |
getSelectColumns(
\xPDO $xpdo, string $className, string $tableAlias
=
'', string $columnPrefix
=
'', array $columns
=
array (), boolean $exclude
=
false
)
:
string
Get a set of column names from an xPDOObject for use in SQL queries.
Inherited from: \xPDOObject::getSelectColumns()\modAccessibleObject::getSelectColumns()\modAccessibleSimpleObject::getSelectColumns()\modResource::getSelectColumns()Name | Type | Description |
---|---|---|
$xpdo | \xPDO | &$xpdo A reference to an initialized xPDO instance. |
$className | string | The class name to get columns from. |
$tableAlias | string | An optional alias for the table in the query. |
$columnPrefix | string | An optional prefix to prepend to each column name. |
$columns | array | An optional array of field names to include or exclude (include is default behavior). |
$exclude | boolean | Determines if any specified columns should be included or excluded from the set of results. |
Type | Description |
---|---|
string | A comma-delimited list of the field names for use in a SELECT clause. |
- Static
getTVValue(
mixed $pk
)
:
\null/mixed
Name | Type | Description |
---|---|---|
$pk | mixed | Either the ID of the TV, or the name of the TV. |
Type | Description |
---|---|
\null/mixed | The value of the TV for the Resource, or null if the TV is not found. |
- Access
- public
getTemplateVarCollection(
\modResource $resource
)
:
\A
Retrieve a collection of Template Variables for a Resource.
Inherited from: \modResource::getTemplateVarCollection()Name | Type | Description |
---|---|---|
$resource | \modResource | &$resource A reference to the modResource to retrieve TemplateVars for. |
Type | Description |
---|---|
\A | collection of modTemplateVar instances for the modResource. |
- Static
getTemplateVars(
)
:
array
Get a collection of the Template Variable values for the Resource.
Inherited from: \modResource::getTemplateVars()Type | Description |
---|---|
array | A collection of TemplateVar values for this Resource. |
getValidator(
)
:
string | boolean
Get the xPDOValidator class configured for this instance.
Inherited from: \xPDOObject::getValidator()\modAccessibleObject::getValidator()\modAccessibleSimpleObject::getValidator()\modResource::getValidator()Type | Description |
---|---|
string | boolean | The xPDOValidator instance or false if it could not be loaded. |
hasChildren(
)
:
integer
Checks to see if the Resource has children or not. Returns the number of children.
Inherited from: \modResource::hasChildren()Type | Description |
---|---|
integer | The number of children of the Resource |
- Access
- public
isDirty(
string $key
)
:
boolean
Indicates if an object field has been modified (or never saved).
Inherited from: \xPDOObject::isDirty()\modAccessibleObject::isDirty()\modAccessibleSimpleObject::isDirty()\modResource::isDirty()Name | Type | Description |
---|---|---|
$key | string | The field name to check. |
Type | Description |
---|---|
boolean | True if the field exists and either has been modified or the object is new. |
- Access
- public
isDuplicateAlias(
string $aliasPath
=
'', string $contextKey
=
''
)
:
mixed
Name | Type | Description |
---|---|---|
$aliasPath | string | The current full alias path. If none is passed, will build it from the Resource's currently set alias. |
$contextKey | string | The context to search for a duplicate alias in. |
Type | Description |
---|---|
mixed | The ID of the Resource using the alias, if a duplicate, otherwise false. |
isLazy(
string $key
=
''
)
:
boolean
Indicates if the object or specified field is lazy.
Inherited from: \xPDOObject::isLazy()\modAccessibleObject::isLazy()\modAccessibleSimpleObject::isLazy()\modResource::isLazy()Name | Type | Description |
---|---|---|
$key | string | Optional key to check for laziness. |
Type | Description |
---|---|
boolean | True if the field specified or if any field is lazy if no field is specified. |
isNew(
)
:
boolean
Indicates if the instance is new, and has not yet been persisted.
Inherited from: \xPDOObject::isNew()\modAccessibleObject::isNew()\modAccessibleSimpleObject::isNew()\modResource::isNew()Type | Description |
---|---|
boolean | True if the object has not been saved or was loaded from the database. |
isValidated(
string $key
=
''
)
:
boolean
Indicates if the object or specified field has been validated.
Inherited from: \xPDOObject::isValidated()\modAccessibleObject::isValidated()\modAccessibleSimpleObject::isValidated()\modResource::isValidated()Name | Type | Description |
---|---|---|
$key | string | Optional key to check for specific validation. |
Type | Description |
---|---|
boolean | True if the object or specified field has been fully validated successfully. |
joinGroup(
mixed $resourceGroupPk
)
:
boolean
Name | Type | Description |
---|---|---|
$resourceGroupPk | mixed | Either the ID, name or object of the Resource Group |
Type | Description |
---|---|
boolean | True if successful. |
- Access
- public
leaveGroup(
int | string | \modResourceGroup $resourceGroupPk
)
:
boolean
Name | Type | Description |
---|---|---|
$resourceGroupPk | int | string | \modResourceGroup | Either the ID, name or object of the Resource Group |
Type | Description |
---|---|
boolean | True if successful. |
- Access
- public
listGroups(
\modResource $resource, array $sort
=
array('id' => 'ASC'), int $limit
=
0, int $offset
=
0
)
:
array
Get a sortable, limitable collection (and total count) of Resource Groups for a given Resource.
Inherited from: \modResource::listGroups()Name | Type | Description |
---|---|---|
$resource | \modResource | &$resource A reference to the modResource to get the groups from. |
$sort | array | An array of sort columns in column => direction format. |
$limit | int | A limit of records to retrieve in the collection. |
$offset | int | A record offset for a limited collection. |
Type | Description |
---|---|
array | An array containing the collection and total. |
- Static
load(
\xPDO $xpdo, string $className, mixed $criteria, boolean | integer $cacheFlag
=
true
)
:
object | null
Custom instance loader that forces access policy checking.
Inherited from: \modAccessibleObject::load()\modAccessibleSimpleObject::load()\modResource::load()Name | Type | Description |
---|---|---|
$xpdo | \xPDO | &$xpdo A valid xPDO instance. |
$className | string | Name of the class. |
$criteria | mixed | A valid primary key, criteria array, or xPDOCriteria instance. |
$cacheFlag | boolean | integer | Indicates if the objects should be cached and optionally, by specifying an integer value, for how many seconds. |
Type | Description |
---|---|
object | null | An instance of the requested class, or null if it could not be instantiated. |
loadCollection(
\xPDO $xpdo, string $className, mixed $criteria
=
null, boolean | integer $cacheFlag
=
true
)
:
array
Custom collection loader that forces access policy checking.
Inherited from: \modAccessibleObject::loadCollection()\modAccessibleSimpleObject::loadCollection()\modResource::loadCollection()Name | Type | Description |
---|---|---|
$xpdo | \xPDO | &$xpdo A valid xPDO instance. |
$className | string | Name of the class. |
$criteria | mixed | A valid primary key, criteria array, or xPDOCriteria instance. |
$cacheFlag | boolean | integer | Indicates if the objects should be cached and optionally, by specifying an integer value, for how many seconds. |
Type | Description |
---|---|
array | An array of xPDOObject instances or an empty array if no instances are loaded. |
loadCollectionGraph(
\xPDO $xpdo, string $className, string | array $graph, mixed $criteria, boolean | integer $cacheFlag
)
:
array
Load a collection of xPDOObject instances and a graph of related objects.
Inherited from: \xPDOObject::loadCollectionGraph()\modAccessibleObject::loadCollectionGraph()\modAccessibleSimpleObject::loadCollectionGraph()\modResource::loadCollectionGraph()Name | Type | Description |
---|---|---|
$xpdo | \xPDO | &$xpdo A valid xPDO instance. |
$className | string | Name of the class. |
$graph | string | array | A related object graph in array or JSON format, e.g. array('relationAlias'=>array('subRelationAlias'=>array())) or {"relationAlias":{"subRelationAlias":{}}}. Note that the empty arrays are necessary in order for the relation to be recognized. |
$criteria | mixed | A valid primary key, criteria array, or xPDOCriteria instance. |
$cacheFlag | boolean | integer | Indicates if the objects should be cached and optionally, by specifying an integer value, for how many seconds. |
Type | Description |
---|---|
array | An array of xPDOObject instances or an empty array if no instances are loaded. |
- Static
prepareTreeNode(
array $node
=
array()
)
:
array
Use this in your extended Resource class to modify the tree node contents
Inherited from: \modResource::prepareTreeNode()Name | Type | Description |
---|---|---|
$node | array |
Type | Description |
---|---|
array |
process(
)
:
string
Process the modSymLink and forward to the specified resource.
Type | Description |
---|---|
string | The processed cacheable content of a resource. |
refreshURIs(
\modX $modx, int $parent
=
0, array $options
=
array()
)
:
void
Refresh Resource URI fields for children of the specified parent.
Inherited from: \modResource::refreshURIs()Name | Type | Description |
---|---|---|
$modx | \modX | &$modx A reference to a valid modX instance. |
$parent | int | The id of a Resource parent to start from (default is 0, the root) |
$options | array | An array of various options for the method: - resetOverrides: if true, Resources with uri_override set to true will be included - contexts: an optional array of context keys to limit the refresh scope |
- Static
remove(
array $ancestors
=
array ()
)
:
boolean
Custom remove that respects access policies.
Inherited from: \modAccessibleObject::remove()\modAccessibleSimpleObject::remove()\modResource::remove()Deletes the persistent object isntance stored in the database when called, including any dependent objects defined by composite foreign key relationships.
Name | Type | Description |
---|---|---|
$ancestors | array | Keeps track of classes which have already been removed to prevent loop with circular references. |
Type | Description |
---|---|
boolean | Returns true on success, false on failure. |
removeLock(
int $user
=
0
)
:
boolean
Name | Type | Description |
---|---|---|
$user | int |
Type | Description |
---|---|
boolean | True if locks were removed. |
- Access
- public
removeValidationRules(
string $field
=
null, array $rules
=
array()
)
:
void
Remove one or more validation rules from this instance.
Inherited from: \xPDOObject::removeValidationRules()\modAccessibleObject::removeValidationRules()\modAccessibleSimpleObject::removeValidationRules()\modResource::removeValidationRules()Name | Type | Description |
---|---|---|
$field | string | An optional field name to remove rules from. If not specified or null, all rules from all columns will be removed. |
$rules | array | An optional array of rule names to remove if a single field is specified. If $field is null, this parameter is ignored. |
save(
boolean $cacheFlag
=
null
)
:
boolean
Persist new or changed modResource instances to the database container.
Inherited from: \modResource::save()If the modResource is new, the createdon and createdby fields will be set using the current time and user authenticated in the context.
If uri is empty or uri_overridden is not set and something has been changed which might affect the Resource's uri, it is (re-)calculated using getAliasPath(). This can be forced recursively by setting refreshURIs to true before calling save().
Name | Type | Description |
---|---|---|
$cacheFlag | boolean |
Type | Description |
---|---|
boolean |
set(
string $k, mixed $v
=
null, string | \callable $vType
=
''
)
:
boolean
Additional logic added for the following fields: -alias: Applies {@link modResource::cleanAlias()} -contentType: Calls {@link modResource::addOne()} to sync contentType -content_type: Sets the contentType field appropriately
Name | Type | Description |
---|---|---|
$k | string | The field key or name. |
$v | mixed | The value to set the field to. |
$vType | string | \callable | A string indicating the format of the provided value parameter, or a callable function that should be used to set the field value, overriding the default behavior. |
Type | Description |
---|---|
boolean | Determines whether the value was set successfully and was determined to be dirty (i.e. different from the previous value). |
setContent(
mixed $content, array $options
=
array()
)
:
boolean
Name | Type | Description |
---|---|---|
$content | mixed | The source content; implementations can decide if it can only be a string, or some other source from which to retrieve it. |
$options | array | An array of options implementations can use to accept language, revision identifiers, or other information to alter the behavior of the method. |
Type | Description |
---|---|
boolean | True indicates the content was set. |
setDirty(
string $key
=
''
)
:
void
Add the field to a collection of field keys that have been modified.
Inherited from: \xPDOObject::setDirty()\modAccessibleObject::setDirty()\modAccessibleSimpleObject::setDirty()\modResource::setDirty()This function also clears any validation flag associated with the field.
Name | Type | Description |
---|---|---|
$key | string | The key of the field to set dirty. |
setOption(
string $key, mixed $value
)
:
void
Set an option value for this instance.
Inherited from: \xPDOObject::setOption()\modAccessibleObject::setOption()\modAccessibleSimpleObject::setOption()\modResource::setOption()Name | Type | Description |
---|---|---|
$key | string | The option key to set a value for. |
$value | mixed | A value to assign to the option. |
setPolicies(
array $policies
=
array()
)
:
void
Set the current object's policies.
Inherited from: \modAccessibleObject::setPolicies()\modAccessibleSimpleObject::setPolicies()\modResource::setPolicies()Name | Type | Description |
---|---|---|
$policies | array |
setProcessed(
boolean $processed
)
:
void
Set the field indicating the resource has been processed.
Inherited from: \modResource::setProcessed()Name | Type | Description |
---|---|---|
$processed | boolean | Pass true to indicate the Resource has been processed. |
setProperties(
array $newProperties, string $namespace
=
'core', bool $merge
=
true
)
:
boolean
Set properties for a namespace on the Resource, optionally merging them with existing ones.
Inherited from: \modResource::setProperties()Name | Type | Description |
---|---|---|
$newProperties | array | |
$namespace | string | |
$merge | bool |
Type | Description |
---|---|
boolean |
setProperty(
string $key, mixed $value, string $namespace
=
'core'
)
:
bool
Name | Type | Description |
---|---|---|
$key | string | |
$value | mixed | |
$namespace | string |
Type | Description |
---|---|
bool |
setTVValue(
mixed $pk, string $value
)
:
bool
Name | Type | Description |
---|---|---|
$pk | mixed | The TV name or ID to set |
$value | string | The value to set for the TV |
Type | Description |
---|---|
bool | Whether or not the TV saved successfully |
toArray(
string $keyPrefix
=
'', boolean $rawValues
=
false, boolean $excludeLazy
=
false, boolean | integer | string | array $includeRelated
=
false
)
:
array
Copies the object fields and corresponding values to an associative array.
Inherited from: \xPDOObject::toArray()\modAccessibleObject::toArray()\modAccessibleSimpleObject::toArray()\modResource::toArray()Name | Type | Description |
---|---|---|
$keyPrefix | string | An optional prefix to prepend to the field values. |
$rawValues | boolean | An optional flag indicating if you want the raw values instead of those returned by the {@link xPDOObject::get()} function. |
$excludeLazy | boolean | An option flag indicating if you want to exclude lazy fields from the resulting array; the default behavior is to include them which means the object will query the database for the lazy fields before providing the value. |
$includeRelated | boolean | integer | string | array | Describes if and how to include loaded related object fields. As an integer all loaded related objects in the graph up to that level of depth will be included. As a string, only loaded related objects matching the JSON graph representation will be included. As an array, only loaded related objects matching the graph array will be included. As boolean true, all currently loaded related objects will be included. |
Type | Description |
---|---|
array | An array representation of the object fields/values. |
toJSON(
string $keyPrefix
=
'', boolean $rawValues
=
false
)
:
string
Returns a JSON representation of the object.
Inherited from: \xPDOObject::toJSON()\modAccessibleObject::toJSON()\modAccessibleSimpleObject::toJSON()\modResource::toJSON()Name | Type | Description |
---|---|---|
$keyPrefix | string | An optional prefix to prepend to the field keys. |
$rawValues | boolean | An optional flag indicating if the field values should be returned raw or via {@link xPDOObject::get()}. |
Type | Description |
---|---|
string | A JSON string representing the object. |
updateContextOfChildren(
\modX $modx, \modResource $parent, array $options
=
array()
)
:
int
Updates the Context of all Children recursively to that of the parent.
Inherited from: \modResource::updateContextOfChildren()Name | Type | Description |
---|---|---|
$modx | \modX | &$modx A reference to an initialized modX instance. |
$parent | \modResource | The parent modResource instance. |
$options | array | An array of options. |
Type | Description |
---|---|
int | The number of children updated. |
- Static
validate(
array $options
=
array()
)
:
boolean
Validate the field values using an xPDOValidator.
Inherited from: \xPDOObject::validate()\modAccessibleObject::validate()\modAccessibleSimpleObject::validate()\modResource::validate()Name | Type | Description |
---|---|---|
$options | array | An array of options to pass to the validator. |
Type | Description |
---|---|
boolean | True if validation was successful. |