Open Source Content Management System

Methods of Midgard Objects

  1. Object management methods
  2. Attachment handling methods
  3. Parameter handling methods
  4. Multilingual content methods
  5. Object instances in Classic API
    1. Fetchables
  6. Full instances

All data in Midgard is available in object-oriented fashion using the MgdSchema data abstration system. The content objects in Midgard provide a consistent programming API for manipulating them.

Object management methods

Attachment handling methods

Parameter handling methods

Multilingual content methods

Object instances in Classic API

Note that class members of the form ___*___ are private by definition. No application should ever access those, not even read-only!

Fetchables

The objects returned by the mgd_list_() functions are "truncated" due to obvious performance issue) and have only the following five common members:

<?php  
// General object prototype for fetchables  

class MidgardFetchable 
{  
    $__table__;     // PRIVATE!  
    $__res__;       // PRIVATE!  

    $N;             // Number of items in the list  
    $id;            // id of the current instance  
    $sitegroup;     // sitegroup of the current instance  

    fetch();        // The only method: fetches the next  
                    // instance in the result list  
}

Both $N and $__res__ are specific only to this truncated form of Midgard objects and are used internally by the fetch() method. Most specific Midgard classes currently have more members than the ones mentioned above. Those additional members help easily building lists, but may become deprecated in the future.

Full instances

The full instances of Midgard classes must be obtained with the appropriate mgd_get_() function. Those mgd_get_() functions return a fully fledged object without $N and $__res__, but with all the members and methods properties described in the manual chapter explaining the object.

Although Midgard classes are not real PHP classes, you can sub-class them and thus extend their functionality:

class Expert extends MidgardPerson  
{  
    function Expert($id)
    {  
        $mgd = mgd_get_person($id);  
        if ($mgd) 
        {  
            foreach (get_object_vars($mgd) as $k=>$v) 
            {  
                $this->$k = $v;  
            }
        }
    }  
    /* add your own methods here */  
}
Designed by Nemein, hosted by Anykey