1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
# Movable Type (r) Open Source (C) 2001-2012 Six Apart, Ltd.
# This program is distributed under the terms of the
# GNU General Public License, version 2.
#
# $Id$
package MT::Placement;
use strict;
use base qw( MT::Object );
__PACKAGE__->install_properties(
{ column_defs => {
'id' => 'integer not null auto_increment',
'blog_id' => 'integer not null',
'entry_id' => 'integer not null',
'category_id' => 'integer not null',
'is_primary' => 'boolean not null',
},
indexes => {
blog_id => 1,
entry_id => 1,
category_id => 1,
is_primary => 1,
blog_cat => { columns => [ 'blog_id', 'category_id' ], },
},
datasource => 'placement',
primary_key => 'id',
cacheable => 0,
}
);
sub class_label {
MT->translate("Category Placement");
}
1;
__END__
=head1 NAME
MT::Placement - Movable Type entry-category placement record
=head1 SYNOPSIS
use MT::Placement;
my $place = MT::Placement->new;
$place->entry_id($entry->id);
$place->blog_id($entry->blog_id);
$place->category_id($cat->id);
$place->is_primary(1);
$place->save
or die $place->errstr;
=head1 DESCRIPTION
An I<MT::Placement> object represents a single entry-category assignment; in
other words, I<MT::Placement> objects describe the assignment of entries into
categories. Each entry is assigned to one primary category and any number of
secondary categories; an I<MT::Placement> object exists for each such
assignment. An entry's assignment to its primary category is marked as a
primary placement.
=head1 USAGE
As a subclass of I<MT::Object>, I<MT::Placement> inherits all of the
data-management and -storage methods from that class; thus you should look
at the I<MT::Object> documentation for details about creating a new object,
loading an existing object, saving an object, etc.
=head1 DATA ACCESS METHODS
The I<MT::Placement> object holds the following pieces of data. These fields
can be accessed and set using the standard data access methods described in the
I<MT::Object> documentation.
=over 4
=item * id
The numeric ID of the placement.
=item * entry_id
The numeric ID of the entry.
=item * category_id
The numeric ID of the category.
=item * is_primary
A boolean flag specifying whether the placement is a "primary" placement, and
hence whether it represents the entry's primary category.
=back
=head1 DATA LOOKUP
In addition to numeric ID lookup, you can look up or sort records by any
combination of the following fields. See the I<load> documentation in
I<MT::Object> for more information.
=over 4
=item * entry_id
=item * category_id
=item * is_primary
=back
=head1 AUTHOR & COPYRIGHTS
Please see the I<MT> manpage for author, copyright, and license information.
=cut
|