Properties

$mgdschema_class

$mgdschema_class : 

Type

$_component

$_component : string

The name of the component, e.g. net.nehmer.static. Should be used whenever the component's name is required instead of hardcoding it.

Type

string

$_i18n

$_i18n : \midcom_services_i18n

A handle to the i18n service.

Type

\midcom_services_i18n

$_l10n

$_l10n : \midcom_services_i18n_l10n

The components' L10n string database.

Type

\midcom_services_i18n_l10n

$_l10n_midcom

$_l10n_midcom : \midcom_services_i18n_l10n

The global MidCOM string database.

Type

\midcom_services_i18n_l10n

$_config

$_config : \midcom_helper_configuration

The current configuration.

Type

\midcom_helper_configuration

$_mgd_reflector

$_mgd_reflector : 

Type

$_dummy_object

$_dummy_object : 

Type

$_cache

$_cache : 

Type

$_services

$_services : array

Array that holds the already instantiated services

Type

array

Methods

__construct()

__construct() 

Initialize all member variables, remember to set $_component before calling this constructor from your derived classes.

get()

get(mixed  $src) : static

Get cached reflector instance

Parameters

mixed $src

Object or classname

Returns

static

get_object_fieldnames()

get_object_fieldnames(object  $object) : array

Get object's (mgdschema) fieldnames.

Parameters

object $object

Object The object to query

Returns

array —

The object vars

property_exists()

property_exists(string  $property, boolean  $metadata = false) : boolean

Parameters

string $property
boolean $metadata

Returns

boolean

get_component_l10n()

get_component_l10n() : \midcom_services_i18n_l10n

Gets a midcom_helper_l10n instance for component governing the type

Returns

\midcom_services_i18n_l10n

Localization library for the reflector object class

get_class_label()

get_class_label() : string

Get the localized label of the class

Returns

string —

Class label

get_label_property()

get_label_property() : string

Get property name to use as label

Returns

string —

name of property to use as label (or false on failure)

get_object_label()

get_object_label(mixed  $object) : string

Get the object label property value

Parameters

mixed $object

MgdSchema object

Returns

string —

Label of the object

get_create_icon()

get_create_icon(string  $type) : string

Get the name of the create icon image

Parameters

string $type

Name of the type

Returns

string —

URL name of the image

get_object_icon()

get_object_icon(mixed  $obj) : string

Get the object icon

Parameters

mixed $obj

MgdSchema object

Returns

string —

Icon (FontAwesome)

get_search_properties()

get_search_properties() : array

Get class properties to use as search fields in choosers or other direct DB searches

Returns

array —

of property names

get_link_properties()

get_link_properties() : array

Gets a list of link properties and the links target info

Link info key specification 'class' string link target class name 'target' string link target property (of target class) 'parent' boolean link is link to "parent" in object tree 'up' boolean link is link to "up" in object tree

Returns

array —

multidimensional array keyed by property, values are arrays with link info (or false in case of failure)

class_rewrite()

class_rewrite(string  $schema_type) : string

Map extended classes

For example org.openpsa.* components often expand core objects, in config we specify which classes we wish to substitute with which

Parameters

string $schema_type

classname to check rewriting for

Returns

string —

new classname (or original in case no rewriting is to be done)

is_same_class()

is_same_class(string  $class_one, string  $class_two) : boolean

See if two MgdSchema classes are the same

NOTE: also takes into account the various extended class scenarios

Parameters

string $class_one

first class to compare

string $class_two

second class to compare

Returns

boolean —

response

resolve_baseclass()

resolve_baseclass(mixed  $classname) : string

Get the MgdSchema classname for given class

Parameters

mixed $classname

either string (class name) or object

Returns

string —

the base class name

get_name_property_nonstatic()

get_name_property_nonstatic(object  $object) : string

Resolve the "name" property of given object

Parameters

object $object

the object to get the name property for

Returns

string —

name of property or boolean false on failure

get_name_property()

get_name_property(object  $object) : string

Resolve the "name" property of given object

Parameters

object $object

the object to get the name property for

Returns

string —

name of property or boolean false on failure

get_object_title()

get_object_title(object  $object, string  $title_property = null) : string

Resolve the "title" of given object

NOTE: This is distinctly different from get_object_label, which will always return something even if it's just the class name and GUID, also it will for some classes include extra info (like datetimes) which we do not want here.

Parameters

object $object

the object to get the name property for

string $title_property

property to use as "name", if left to default (null), will be reflected

Returns

string —

value of name property or boolean false on failure

get_title_property()

get_title_property(object  $object) : string

Resolve the "title" property of given object

NOTE: This is distinctly different from get_label_property, which will always return something even if it's just the guid

Parameters

object $object

The object to get the title property for

Returns

string —

Name of property or boolean false on failure

get_title_property_nonstatic()

get_title_property_nonstatic(object  $object) : string

Resolve the "title" property of given object

NOTE: This is distinctly different from get_label_property, which will always return something even if it's just the guid

Parameters

object $object

the object to get the title property for

Returns

string —

name of property or boolean false on failure

__get()

__get(  $field) 

Parameters

$field

__isset()

__isset(  $field) 

Parameters

$field

set_active_leaf()

set_active_leaf(  $leaf_id) 

Parameters

$leaf_id

add_stylesheet()

add_stylesheet(string  $url, string  $media = false) 

Convenience shortcut for adding CSS files

Parameters

string $url

The stylesheet URL

string $media

The media type(s) for the stylesheet, if any

get_workflow()

get_workflow(string  $identifier, array  $options = array()) : \midcom\workflow\dialog

Parameters

string $identifier
array $options

Returns

\midcom\workflow\dialog

_root_objects_qb()

_root_objects_qb(  $deleted) 

Creates a QB instance for get_root_objects

Parameters

$deleted

get_root_objects()

get_root_objects(boolean  $deleted = false) : array

Get "root" objects for the class this reflector was instantiated for

NOTE: deleted objects can only be listed as admin, also: they do not come MidCOM DBA wrapped (since you cannot normally instantiate such object)

Parameters

boolean $deleted

whether to get (only) deleted or not-deleted objects

Returns

array —

of objects or false on failure

resolve_path()

resolve_path(\midgard_object  $object, string  $separator = ' > ') : string

Get rendered path for object

Parameters

\midgard_object $object

The object to get path for

string $separator

the string used to separate path components

Returns

string —

resolved path

resolve_path_parts()

resolve_path_parts(\midgard_object  $object) : array

Get path components for object

Parameters

\midgard_object $object

The object to get path for

Returns

array —

path components

get_parent()

get_parent(\midgard_object  $object) 

Get the parent object of given object

Tries to utilize MidCOM DBA features first but can fallback on pure MgdSchema as necessary

NOTE: since this might fall back to pure MgdSchema never trust that MidCOM DBA features are available, check for is_callable/method_exists first !

Parameters

\midgard_object $object

the object to get parent for

get_child_objects()

get_child_objects(\midgard_object  $object, boolean  $deleted = false) : array

Get children of given object

Parameters

\midgard_object $object

object to get children for

boolean $deleted

whether to get (only) deleted or not-deleted objects

Returns

array —

multidimensional array (keyed by classname) of objects or false on failure

_child_objects_type_qb()

_child_objects_type_qb(  $schema_type,   $for_object,   $deleted) 

Creates a QB instance for _get_child_objects_type

Parameters

$schema_type
$for_object
$deleted

_get_child_objects_type()

_get_child_objects_type(  $schema_type,   $for_object,   $deleted) : array

Used by get_child_objects

Parameters

$schema_type
$for_object
$deleted

Returns

array —

of objects

get_parent_class()

get_parent_class() : string

Get the parent class of the class this reflector was instantiated for

Returns

string —

class name (or false if the type has no parent)

get_child_classes()

get_child_classes() : array

Get the child classes of the class this reflector was instantiated for

Returns

array —

of class names

get_root_classes()

get_root_classes() : array

Get an array of "root level" classes, can (and should) be called statically

Returns

array —

of classnames (or false on critical failure)

add_schema_sorts_to_qb()

add_schema_sorts_to_qb(\midgard_query_builder  $qb, string  $schema_type) 

Add default ("title" and "name") sorts to a QB instance

Parameters

\midgard_query_builder $qb

QB instance

string $schema_type

valid mgdschema class name

get_tree()

get_tree(\midcom_core_dbaobject  $parent) : array

List object children

Parameters

\midcom_core_dbaobject $parent

Returns

array

_get_icon_map()

_get_icon_map(  $config_key,   $fallback) 

Parameters

$config_key
$fallback

_check_permissions()

_check_permissions(  $deleted) 

Parameters

$deleted

_get_type_qb()

_get_type_qb(  $schema_type,   $deleted) 

Parameters

$schema_type
$deleted

_get_link_fields()

_get_link_fields(  $schema_type,   $for_object) 

Figure out constraint(s) to use to get child objects

Parameters

$schema_type
$for_object

_resolve_child_classes()

_resolve_child_classes() : array

Resolve the child classes of the class this reflector was instantiated for, used by get_child_classes()

Returns

array —

of class names

_resolve_child_classes_links_back()

_resolve_child_classes_links_back(  $property,   $prospect_type,   $schema_type) 

Parameters

$property
$prospect_type
$schema_type

_resolve_root_classes()

_resolve_root_classes() : array

Resolves the "root level" classes, used by get_root_classes()

Returns

array —

of classnames (or false on critical failure)