SYNOPSIS
Creating an MT::Object subclass:
package MT::Foo;
use strict;
use base 'MT::Object';
__PACKAGE__->install_properties({
columns_defs => {
'id' => 'integer not null auto_increment',
'foo' => 'string(255)',
},
indexes => {
foo => 1,
},
primary_key => 'id',
datasource => 'foo',
});
Using an MT::Object subclass:
use MT;
use MT::Foo;
## Create an MT object to load the system configuration and
## initialize an object driver.
my $mt = MT->new;
## Create an MT::Foo object, fill it with data, and save it;
## the object is saved using the object driver initialized above.
my $foo = MT::Foo->new;
$foo->foo('bar');
$foo->save
or die $foo->errstr;
This page is part of the MT::Object Reference
- Previous NAME
This page was last updated on 2008-10-01, 17:07.
Leave a note
Have a question? Please use the MT Forums. Notes submitted on documentation should pertain to tips & hints regarding documentation. Your note may be removed once its contents have been integrated into the body of the page.