core/model/modx/sqlsrv/moddashboard.class.php

\modDashboard_sqlsrv

Extend to define a class with a native integer primary key field named id.

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.

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.

Parameters

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.

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.

Parameters

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).

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).

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.

Returns

Type

Description

array

An array of xPDOObject instances or an empty array if no instances are loaded.

Details

Static

remove(
array $ancestors
=
array ()
)
:
boolean

inherited

Override xPDOObject::remove() to revert to the default dashboard any user groups using this Dashboard

Inserts or updates the database record representing this object and any
new or changed related object records. Both aggregate and composite
related objects will be saved as appropriate, before or following the
save operation on the controlling instance.

Parameters

Name

Type

Description

$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(s).

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.