BaseCat.class.php 5.9 KB
Newer Older
Яков's avatar
first  
Яков committed
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?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);
    }
}