\midcom_helper_reflector

The Grand Unified Reflector

Note, that the request data, for ease of use, already contains the L10n Databases of the Component and MidCOM itself located in this class. They are stored as 'l10n' and 'l10n_midcom'. Also available as 'config' is the current component configuration.

Summary

Methods
Properties
Constants
__construct()
__get()
__isset()
set_active_leaf()
add_stylesheet()
get_workflow()
get()
get_object_fieldnames()
property_exists()
get_component_l10n()
get_class_label()
get_label_property()
get_object_label()
get_create_icon()
get_object_icon()
get_search_properties()
get_link_properties()
class_rewrite()
is_same_class()
resolve_baseclass()
get_name_property_nonstatic()
get_name_property()
get_object_title()
get_title_property()
get_title_property_nonstatic()
$_component
$mgdschema_class
$_i18n
$_l10n
$_l10n_midcom
$_config
No constants found
No protected methods found
$_mgd_reflector
$_dummy_object
N/A
_get_icon_map()
$_services
$_cache
N/A

Properties

$_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

$mgdschema_class

$mgdschema_class : 

Type

$_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

$_services

$_services : array

Array that holds the already instantiated services

Type

array

$_cache

$_cache : 

Type

Methods

__construct()

__construct(string|\midgard_object  $src) 

Constructor, takes classname or object, resolved MgdSchema root class automagically

Parameters

string|\midgard_object $src

classname or object

__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

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_icon_map()

_get_icon_map(  $config_key,   $fallback) 

Parameters

$config_key
$fallback