<?php

/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
abstract class BasePage extends Doctrine_Record
{

public function setTableDefinition()
{
$this->setTableName('page');
$this->hasColumn('title', 'string', 60, array(
'notblank' => true,
));
$this->hasColumn('date_published', 'date', null, array(
'notnull' => true,
));
$this->hasColumn('date_revised', 'date', null);
$this->hasColumn('page_type', 'string', 20, array(
'regexp' => '/^(static|list)$/',
'default' => 'static',
));
$this->hasColumn('body', 'clob', null);
$this->hasColumn('summary', 'clob', null);
$this->hasColumn('status', 'boolean', null, array(
'default' => 1,
));
$this->hasColumn('admin', 'boolean', null, array(
'default' => 1,
));
$this->hasColumn('show_rss_out', 'boolean', null, array(
'default' => 0,
));
$this->hasColumn('rss_title', 'string', 60);
$this->hasColumn('rss_url', 'string', 255);
$this->hasColumn('list_type', 'string', 20, array(
'regexp' => '/^(article|workshop)?$/',
));
$this->hasColumn('list_number', 'string', 5, array(
'regexp' => '/^(\d{2}p?)?$/',
));
$this->hasColumn('list_sortby', 'string', 20, array(
'regexp' => '/^(title|date)?$/',
));
$this->hasColumn('article_list_type', 'string', 30);
$this->hasColumn('article_list_subject_filter', 'integer', null);

$this->hasColumn('workshop_list_type', 'string', 30, array(
'regexp' => '/^(schedule|types)?$/'
));
$this->hasColumn('workshop_list_level_filter', 'integer', 3, array(
'unsigned' => true,
));
$this->hasColumn('author_id', 'integer', null);


$this->index('title_index', array(
'fields' => 'title'
));
$this->option('charset', 'utf8');
$this->option('type', 'INNODB');
}

public function setUp()
{
$this->hasMany('Subject as subjects', array('refClass' => 'PageSubject',
'local' => 'page_id',
'foreign' => 'subject_id'));

$this->hasOne('Author as author', array('local' => 'author_id',
'foreign' => 'id'));

$this->hasOne('Menu as menu_item', array('local' => 'id',
'foreign' => 'page_id',
'onDelete' => 'CASCADE'));
}

}