Open Source Content Management Framework

PHP midgard object attachments

  1. Methods

This part of API is forward compatible and it's recommended for Midgard 1.9/2.0. This is experimental section.

Attachment objects are very similiar to parameters, however the main purpose of attachments is to handle reference to files located in file system. Together with midgard_blob provide an easy to use way to manage real files. Both attachment and blob objects allow to access files, but attachment objects may be stored in database while blob ones are created during runtime.

Attachments are represented by midgard_attachment class, but API methods provides faster implementation. All attachments are associated with objects ( parents ) with parentguid property which holds parent object's guid value.

There's no method to update object's attachment, as this can be done with Mgdschema update method. All created or fetched attachment objects are regular MgdSchema objects.

You should create attachments like this:

<?php

$object = new midgard_page($guid);
$att = $object->create_attachment("unique name");

?>

Instead of:

<?php

$object = new midgard_page($guid);  
$att  = new midgard_attachment();
$att->parentguid = $object->guid;
$att->name = "unique name";
$att->create();

?>

Methods

Designed by Nemein, hosted by Kafit