Not a developer? Go to MovableType.com

Documentation

METADATA

The following methods facilitate the storage and management of metadata; available when the ‘meta’ key is included in the installed properties for the class.

$obj->init_meta()

For object classes that have metadata storage, this method will initialize the metadata member.

Class->install_meta( \%meta_properties )

Called to register metadata properties on a particular class. The %meta_properties may contain an arrayref of ‘columns’, or a hashref of ‘column_defs’ (similar to the install_properties method):

MT::Foo->install_meta( { column_defs => {
    'metadata1' => 'integer indexed',
    'metadata2' => 'string indexed',
} });

In this form, the storage type is explicitly declared, so the metadata is stored into the appropriate column (vintegeridx and vcharidx respectively).

MT::Foo->install\_meta( { columns => [ 'metadata1', 'metadata2' ] } )

In this form, the metadata properties store their data into a ‘blob’ column in the meta table. This type of metadata cannot be used to sort or filter on. This form is supported for backward compatibility and is considered deprecated.

$obj->remove_meta()

Deletes all related metadata for the given object.

Class->search_by_meta( $key, $value, [ \%terms [, \%args ] ] )

Returns objects that have a $key metadata value of $value. Further restrictions on the class may be applied through the optional %terms and %args parameters.

$obj->meta_obj()

Returns the MT::Object class

Class->meta_pkg()

Returns the Perl package name for storing it’s metadata objects.

Class->meta_args

Returns the source of a Perl package declaration that is loaded to declare and process metadata objects for the Class.

Class->has_meta( [ $name ] )

Returns a boolean as to whether the class has metadata when called without a parameter, or whether there exists a metadata column of the given $name.

Class->is_meta_column( $name )

Returns a boolean as to whether the class has a meta column named $name.

Back

Leave a Comment