Open Source Content Management Framework

MidCOM DBA object constructor

  1. Creating empty objects
  2. Loading objects from the database

midcom_baseclasses_database_article(mixed $id = null);

Creating empty objects

If you need an empty object, for example to create a new object instance, you just use the default constructor:

$article = new midcom_baseclasses_database_article();
$article->title = $title;
$article->name = $name;
$article->topic = $topic_id;
$article->create();

Required privilges: None for the construction operation itself.

Loading objects from the database

Otherwise, you can pass either an ID or an GUID to the constructor, which will then try to load the corresponding record from the database using the MgdSchemaClass::get_by_id() and MgdSchemaClass::get_by_guid() methods.

If the retrieval of the object fails, you will get false instead of a class instance.

$article = new midcom_baseclasses_database_article($id);
// or
$article = new midcom_baseclasses_database_article($guid);

Required privilges: midgard:read on the record to be accessed.

< Back to the MidCOM DBA Object API overview

Designed by Nemein, hosted by Anykey