<?php

/**
 * BaseCat
 * 
 * This class has been auto-generated by the Doctrine ORM Framework
 * 
 * @property text $inner_id
 * @property string $alias
 * @property string $photo
 * @property string $title
 * @property integer $parent_id
 * @property integer $order_id
 * @property enum $view_type
 * @property boolean $is_filter
 * @property boolean $is_main
 * @property integer $sort
 * @property Cat $Parent
 * @property Doctrine_Collection $Children
 * @property Doctrine_Collection $Products
 * @property Doctrine_Collection $CatProduct
 * 
 * @method text                getInnerId()    Returns the current record's "inner_id" value
 * @method string              getAlias()      Returns the current record's "alias" value
 * @method string              getPhoto()      Returns the current record's "photo" value
 * @method string              getTitle()      Returns the current record's "title" value
 * @method integer             getParentId()   Returns the current record's "parent_id" value
 * @method integer             getOrderId()    Returns the current record's "order_id" value
 * @method enum                getViewType()   Returns the current record's "view_type" value
 * @method boolean             getIsFilter()   Returns the current record's "is_filter" value
 * @method boolean             getIsMain()     Returns the current record's "is_main" value
 * @method integer             getSort()       Returns the current record's "sort" value
 * @method Cat                 getParent()     Returns the current record's "Parent" value
 * @method Doctrine_Collection getChildren()   Returns the current record's "Children" collection
 * @method Doctrine_Collection getProducts()   Returns the current record's "Products" collection
 * @method Doctrine_Collection getCatProduct() Returns the current record's "CatProduct" collection
 * @method Cat                 setInnerId()    Sets the current record's "inner_id" value
 * @method Cat                 setAlias()      Sets the current record's "alias" value
 * @method Cat                 setPhoto()      Sets the current record's "photo" value
 * @method Cat                 setTitle()      Sets the current record's "title" value
 * @method Cat                 setParentId()   Sets the current record's "parent_id" value
 * @method Cat                 setOrderId()    Sets the current record's "order_id" value
 * @method Cat                 setViewType()   Sets the current record's "view_type" value
 * @method Cat                 setIsFilter()   Sets the current record's "is_filter" value
 * @method Cat                 setIsMain()     Sets the current record's "is_main" value
 * @method Cat                 setSort()       Sets the current record's "sort" value
 * @method Cat                 setParent()     Sets the current record's "Parent" value
 * @method Cat                 setChildren()   Sets the current record's "Children" collection
 * @method Cat                 setProducts()   Sets the current record's "Products" collection
 * @method Cat                 setCatProduct() Sets the current record's "CatProduct" collection
 * 
 * @package    sf
 * @subpackage model
 * @author     Atma
 * @version    SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
 */
abstract class BaseCat extends sfDoctrineRecord
{
    public function setTableDefinition()
    {
        $this->setTableName('cat');
        $this->hasColumn('inner_id', 'text', null, array(
             'type' => 'text',
             ));
        $this->hasColumn('alias', 'string', 255, array(
             'type' => 'string',
             'notnull' => true,
             'unique' => true,
             'length' => 255,
             ));
        $this->hasColumn('photo', 'string', 255, array(
             'type' => 'string',
             'notnull' => true,
             'length' => 255,
             ));
        $this->hasColumn('title', 'string', 1000, array(
             'type' => 'string',
             'notnull' => true,
             'length' => 1000,
             ));
        $this->hasColumn('parent_id', 'integer', null, array(
             'type' => 'integer',
             ));
        $this->hasColumn('order_id', 'integer', null, array(
             'type' => 'integer',
             'notnull' => true,
             'default' => 100,
             ));
        $this->hasColumn('view_type', 'enum', null, array(
             'type' => 'enum',
             'values' => 
             array(
              0 => 'Simple',
              1 => 'Standart',
              2 => 'BigStandart',
             ),
             ));
        $this->hasColumn('is_filter', 'boolean', null, array(
             'type' => 'boolean',
             'notnull' => true,
             'default' => false,
             ));
        $this->hasColumn('is_main', 'boolean', null, array(
             'type' => 'boolean',
             'notnull' => true,
             'default' => false,
             ));
        $this->hasColumn('sort', 'integer', null, array(
             'type' => 'integer',
             'default' => 0,
             ));
    }

    public function setUp()
    {
        parent::setUp();
        $this->hasOne('Cat as Parent', array(
             'local' => 'parent_id',
             'foreign' => 'id',
             'onDelete' => 'CASCADE'));

        $this->hasMany('Cat as Children', array(
             'local' => 'id',
             'foreign' => 'parent_id'));

        $this->hasMany('Product as Products', array(
             'refClass' => 'CatProduct',
             'local' => 'cat_id',
             'foreign' => 'product_id',
             'onDelete' => 'CASCADE'));

        $this->hasMany('CatProduct', array(
             'local' => 'id',
             'foreign' => 'cat_id'));

        $timestampable0 = new Doctrine_Template_Timestampable();
        $i18n0 = new Doctrine_Template_I18n(array(
             'fields' => 
             array(
              0 => 'title',
             ),
             ));
        $this->actAs($timestampable0);
        $this->actAs($i18n0);
    }
}