Open Source Content Management System

MgdSchema method update

  1. Midgard 1.8
    1. Multilingual content
  2. Midgard 1.9:
    1. Events
  3. Notes

bool $object->update(void)

Minimum version: Midgard 1.7

Updates object with their properties being set.

<?php  
$id = 2;  
$object = new midgard_style();  
$object->get_by_id($id);  

$object->title = "MyTitle";  

if ($object->update()) print "Object updated!";


?>

Returns TRUE when object was successfully updated, FALSE otherwise. Follow mgd_errstr() function to get error message on failure.

The sitegroup property can not be change with this method.
This property is transparently reset to its initial state when this method is called.

Midgard 1.8

When update method is invoked , such properties are being internally set:

  • metadata.revisor
  • metadata.revision
  • metadata.revised

More about midgard_metadata object.

Multilingual content

If application's language is set to other language than 0 and language content for object's instance doesn't exist, then new language content is created for language which is currently being set.

Midgard 1.9:

Events

  • action_update event is emited when method is invoked
  • action_updated is emited if object is updated
  • action_update_hook event is emited by extension before core's update method is invoked

Read more about events

Notes

Value of object's property 'sitegroup' can not be updated.

When this method is called by SG0 Midgard Administrator and value of an sitegroup property was changed then MGD_ERR_SITEGROUP_VIOLATION is being set, and Resource link crosses sitegroup borders is returned by mgd_errstr() function.

It is possible to "move" object's to SG0 by Midgard Administrator, however such misfeature never should be used in any application.

Designed by Nemein, hosted by Anykey