The Grand Unified Reflector

package midcom.helper.reflector

 Methods

__construct (\string/midgard_object $src)

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

Parameters

$src

\string/midgard_objectclassname or object

class_rewrite (string $schema_type)

Method to map extended classes
Static

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

Parameters

$schema_type

stringclassname to check rewriting for

Returns

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

get (mixed $src)

Get cached reflector instance
Static

Parameters

$src

mixedObject or classname

Returns

\midcom_helper_reflector

get_class_label ()

Get the localized label of the class
todo remove any hardcoded class names/prefixes

Returns

stringClass label

get_component_l10n ()

Gets a midcom_helper_l10n instance for component governing the type

Returns

\midcom_services_i18n_l10nLocalization library for the reflector object class

get_create_icon (string $type)

Get the name of the create icon image
Static

Parameters

$type

stringName of the type

Returns

stringURL name of the image

get_label_property ()

Get property name to use as label
todo remove any hardcoded class names/prefixes

Returns

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

get_name_property (object $object)

Resolve the "name" property of given object
Static
see \midcom_helper_reflector::get_name_property_nonstatic()

Parameters

$object

objectthe object to get the name property for

Returns

stringname of property or boolean false on failure

get_name_property_nonstatic (object $object)

Method to resolve the "name" property of given object
see \midcom_helper_reflector::get_name_property()
todo when midgard_reflection_property supports flagging name fields use that in stead of heuristics

Parameters

$object

objectthe object to get the name property for

Returns

stringname of property or boolean false on failure

get_object (string $guid, string $type)

Get an object, deleted or not
Static

Parameters

$guid

stringGUID of the object

$type

stringMgdSchema type

Returns

mixedMgdSchema object

get_object_icon (mixed $obj, boolean $url_only)

Get the name of the icon image
Static

Parameters

$obj

mixedMgdSchema object

$url_only

booleanGet only the URL location instead of full tag

Returns

stringURL name of the image

get_object_label (mixed $object)

Get the object label property value
todo remove any hardcoded class names/prefixes

Parameters

$object

mixedMgdSchema object

Returns

StringLabel of the object

get_object_title (object $object, string $title_property)

Resolve the "title" of given object
Static

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

objectthe object to get the name property for

$title_property

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

Returns

stringvalue of name property or boolean false on failure

get_search_properties ()

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

Returns

arrayof property names

get_title_property (object $object)

Resolve the "title" property of given object
Static

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

Parameters

$object

objectThe object to get the title property for

Returns

stringName of property or boolean false on failure

get_title_property_nonstatic ($object)

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

see \midcom_helper_reflector::get_object_title()
todo when midgard_reflection_property supports flagging name fields use that in stead of heuristics

Parameters

$object

the object to get the title property for

Returns

stringname of property or boolean false on failure

is_same_class (string $class_one, string $class_two)

Method to see if two MgdSchema classes are the same
Static

NOTE: also takes into account the various extended class scenarios

Parameters

$class_one

stringfirst class to compare

$class_two

stringsecond class to compare

Returns

booleanresponse

resolve_baseclass (mixed $classname)

Get the MgdSchema classname for given class
Static

Parameters

$classname

mixedeither string (class name) or object

Returns

stringthe base class name

_get_icon_map ($config_key, $fallback)

Static

Parameters

$config_key

$fallback

 Properties

 

mixed $mgdschema_class

 

mixed $_dummy_object

 

mixed $_mgd_reflector

 

mixed $_cache