Not a developer? Go to MovableType.com

Documentation

Objects, Data Structures and Persistence

Movable Type offers a robust system for managing application and user defined data. The primary interface to this system is through the base class MT::Object, which all other objects derive from.

Because all objects inherit from the MT::Object base class that means that all objects will automatically support the following features and behaviors:

  • the methods new, load, save, remove and remove_all are defined automatically

  • all objects will be cached in memcached when properly enabled

  • callbacks into the creation and editing of objects are defined

  • support for storage of that object across all supported databases, including mysql, postgres, SQL Server, Oracle and SQLite

  • upgrades and changes to the underlying database schema are completely automated

Movable Type Objects actually know nothing at all about how they are stored. They simply know about the data they represent. Movable Type’s data abstraction layer takes care of all of the SQL and database specific issues for you.

In Movable Type, developers never have to write SQL.

Movable Type’s Data Abstraction Layer: What is MT::Object, MT::ObjectDriver and Data::ObjectDriver?

For the geeks out there let us take a quick diversion to give ourselves a little background on Movable Type’s data abstraction layer. This layer is what allows developers to store and retrieve all manner of data to and from the database without ever needing to know or understand SQL. It is also what makes it possible for Movable Type to automate database upgrades and easily support multiple databases without developer’s having to grapple with the idiosyncratic differences between them.

There are a number of key classes that make up this framework, they are:

  • MT::Object - the base class from which all other objects derive. Each MT::Object defines the data model for that specific object.

  • MT::ObjectDriver - a thin wrapper around the core underlying data abstraction backend called Data::ObjectDriver. This is maintained for backwards compatibility.

  • Data::ObjectDriver - an open source data abstraction layer for Perl applications. This is where most of the work is done and is what is primarily responsible for converting API calls to SQL statements. It also provides support for memcached and other low level database features like partitioning (a feature planned for a future release).

Back