$_parent_mapping
$_parent_mapping : array
ID => GUID cache for parents
This class contains various factory methods to retrieve objects from the database.
The only instance of this class you should ever use is available through midcom::get()->dbfactory.
get_object_by_guid(string $guid) : \midcom_core_dbaobject
This is a replacement for the original midgard_object_class::get_object_by_guid method, which takes the MidCOM DBA system into account.
string | $guid | The object GUID. |
A MidCOM DBA object if the set GUID is known
get_cached(string $classname, mixed $src) : \midcom_core_dbaobject
Retrieve a reference to an object, uses in-request caching
string | $classname | Which DBA are we dealing with |
mixed | $src | GUID of object (ids work but are discouraged) |
reference to object
new_collector(string $classname, string $domain = null, mixed $value = null) : \midcom_core_collector
This function will determine the correct type of midgard_collector that has to be created. It will also call the _on_prepare_new_collector event handler.
string | $classname | The name of the class for which you want to create a collector. |
string | $domain | The domain property of the collector instance |
mixed | $value | Value match for the collector instance |
The initialized instance of the collector.
new_query_builder(string $classname) : \midcom_core_querybuilder
This function will determine the correct type of midgard_query_builder that has to be created. It will also call the _on_prepare_new_query_builder event handler.
string | $classname | The name of the class for which you want to create a query builder. |
The initialized instance of the query builder.
convert_midgard_to_midcom(\midgard\portable\api\mgdobject $object) : \midcom_core_dbaobject
Convert MgdSchema object into a MidCOM DBA object.
If the conversion cannot be done for some reason, the function returns null and logs an error. We also ensure that the corresponding component has been loaded.
\midgard\portable\api\mgdobject | $object | MgdSchema Object |
convert_midcom_to_midgard(\midcom_core_dbaobject $object) : \midgard\portable\api\mgdobject
Helper function, it takes a MidCOM DBA object and converts it into an MgdSchema object.
If the conversion cannot be done for some reason, the function throws an error.
\midcom_core_dbaobject | $object | MidCOM DBA Object |
MgdSchema Object
is_a(mixed $object, string $class) : boolean
This is a helper for emulating is_a() functionality with MidCOM DBA objects that are decorators.
This method can be used to check whether an object is of a MidCOM DBA or MgdSchema type
mixed | $object | MgdSchema or MidCOM DBA object |
string | $class | Class to check the instance against |
get_parent(\midcom_core_dbaobject $object) : \midcom_core_dbaobject|null
Returns the parent object. Tries to utilize the Memcache data, loading the actual information only if it is not cached.
\midcom_core_dbaobject | $object | The DBA object we're working on |
Parent if found, otherwise null
get_parent_data(mixed $object, string $class = null) : array
Determines the parent GUID for an existing GUID according to the MidCOM content tree rules.
It tries to look up the GUID in the memory cache, only if this fails, the regular content getters are invoked.
mixed | $object | Either a MidCOM DBA object instance, or a GUID string. |
string | $class | class name of object if known (so we can use get_parent_guid_uncached_static and avoid instantiating full object) |
The parent GUID and class (value might be null, if this is a top level object).
_get_parent_guid_uncached(\midcom_core_dbaobject $object)
\midcom_core_dbaobject | $object |