BaseProduct.class.php 10.3 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<?php

/**
 * BaseProduct
 * 
 * This class has been auto-generated by the Doctrine ORM Framework
 * 
 * @property text $inner_id
 * @property string $alias
 * @property string $title
 * @property text $description
 * @property text $chemical_composition
 * @property text $product_img
 * @property integer $supplier_id
 * @property integer $supplier_price
 * @property string $certificate
 * @property integer $offer_count
 * @property boolean $is_detail
 * @property boolean $is_delete
 * @property boolean $is_main
 * @property boolean $show_main
 * @property integer $sort
 * @property boolean $free_shipping
 * @property integer $the_weight
 * @property Doctrine_Collection $Prop
 * @property Doctrine_Collection $Cats
 * @property Suppliers $Suppliers
 * @property Doctrine_Collection $Tags
 * @property Doctrine_Collection $CatProduct
 * @property Doctrine_Collection $ProductTags
 * @property Doctrine_Collection $ProductPropValue
 * @property Doctrine_Collection $Offer
 * 
 * @method text                getInnerId()              Returns the current record's "inner_id" value
 * @method string              getAlias()                Returns the current record's "alias" value
 * @method string              getTitle()                Returns the current record's "title" value
 * @method text                getDescription()          Returns the current record's "description" value
 * @method text                getChemicalComposition()  Returns the current record's "chemical_composition" value
 * @method text                getProductImg()           Returns the current record's "product_img" value
 * @method integer             getSupplierId()           Returns the current record's "supplier_id" value
 * @method integer             getSupplierPrice()        Returns the current record's "supplier_price" value
 * @method string              getCertificate()          Returns the current record's "certificate" value
 * @method integer             getOfferCount()           Returns the current record's "offer_count" value
 * @method boolean             getIsDetail()             Returns the current record's "is_detail" value
 * @method boolean             getIsDelete()             Returns the current record's "is_delete" value
 * @method boolean             getIsMain()               Returns the current record's "is_main" value
 * @method boolean             getShowMain()             Returns the current record's "show_main" value
 * @method integer             getSort()                 Returns the current record's "sort" value
 * @method boolean             getFreeShipping()         Returns the current record's "free_shipping" value
 * @method integer             getTheWeight()            Returns the current record's "the_weight" value
 * @method Doctrine_Collection getProp()                 Returns the current record's "Prop" collection
 * @method Doctrine_Collection getCats()                 Returns the current record's "Cats" collection
 * @method Suppliers           getSuppliers()            Returns the current record's "Suppliers" value
 * @method Doctrine_Collection getTags()                 Returns the current record's "Tags" collection
 * @method Doctrine_Collection getCatProduct()           Returns the current record's "CatProduct" collection
 * @method Doctrine_Collection getProductTags()          Returns the current record's "ProductTags" collection
 * @method Doctrine_Collection getProductPropValue()     Returns the current record's "ProductPropValue" collection
 * @method Doctrine_Collection getOffer()                Returns the current record's "Offer" collection
 * @method Product             setInnerId()              Sets the current record's "inner_id" value
 * @method Product             setAlias()                Sets the current record's "alias" value
 * @method Product             setTitle()                Sets the current record's "title" value
 * @method Product             setDescription()          Sets the current record's "description" value
 * @method Product             setChemicalComposition()  Sets the current record's "chemical_composition" value
 * @method Product             setProductImg()           Sets the current record's "product_img" value
 * @method Product             setSupplierId()           Sets the current record's "supplier_id" value
 * @method Product             setSupplierPrice()        Sets the current record's "supplier_price" value
 * @method Product             setCertificate()          Sets the current record's "certificate" value
 * @method Product             setOfferCount()           Sets the current record's "offer_count" value
 * @method Product             setIsDetail()             Sets the current record's "is_detail" value
 * @method Product             setIsDelete()             Sets the current record's "is_delete" value
 * @method Product             setIsMain()               Sets the current record's "is_main" value
 * @method Product             setShowMain()             Sets the current record's "show_main" value
 * @method Product             setSort()                 Sets the current record's "sort" value
 * @method Product             setFreeShipping()         Sets the current record's "free_shipping" value
 * @method Product             setTheWeight()            Sets the current record's "the_weight" value
 * @method Product             setProp()                 Sets the current record's "Prop" collection
 * @method Product             setCats()                 Sets the current record's "Cats" collection
 * @method Product             setSuppliers()            Sets the current record's "Suppliers" value
 * @method Product             setTags()                 Sets the current record's "Tags" collection
 * @method Product             setCatProduct()           Sets the current record's "CatProduct" collection
 * @method Product             setProductTags()          Sets the current record's "ProductTags" collection
 * @method Product             setProductPropValue()     Sets the current record's "ProductPropValue" collection
 * @method Product             setOffer()                Sets the current record's "Offer" collection
 * 
 * @package    sf
 * @subpackage model
 * @author     Atma
 * @version    SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
 */
abstract class BaseProduct extends sfDoctrineRecord
{
    public function setTableDefinition()
    {
        $this->setTableName('product');
        $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('title', 'string', 1000, array(
             'type' => 'string',
             'notnull' => true,
             'length' => 1000,
             ));
        $this->hasColumn('description', 'text', null, array(
             'type' => 'text',
             ));
        $this->hasColumn('chemical_composition', 'text', null, array(
             'type' => 'text',
             ));
        $this->hasColumn('product_img', 'text', null, array(
             'type' => 'text',
             ));
        $this->hasColumn('supplier_id', 'integer', null, array(
             'type' => 'integer',
             ));
        $this->hasColumn('supplier_price', 'integer', null, array(
             'type' => 'integer',
             ));
        $this->hasColumn('certificate', 'string', 255, array(
             'type' => 'string',
             'length' => 255,
             ));
        $this->hasColumn('offer_count', 'integer', null, array(
             'type' => 'integer',
             'default' => 0,
             'notnull' => true,
             ));
        $this->hasColumn('is_detail', 'boolean', null, array(
             'type' => 'boolean',
             'notnull' => true,
             'default' => true,
             ));
        $this->hasColumn('is_delete', 'boolean', null, array(
             'type' => 'boolean',
             'notnull' => true,
             'default' => false,
             ));
        $this->hasColumn('is_main', 'boolean', null, array(
             'type' => 'boolean',
             'notnull' => true,
             'default' => false,
             ));
        $this->hasColumn('show_main', 'boolean', null, array(
             'type' => 'boolean',
             'notnull' => true,
             'default' => false,
             ));
        $this->hasColumn('sort', 'integer', null, array(
             'type' => 'integer',
             'default' => 0,
             ));
        $this->hasColumn('free_shipping', 'boolean', null, array(
             'type' => 'boolean',
             'default' => false,
             ));
        $this->hasColumn('the_weight', 'integer', null, array(
             'type' => 'integer',
             'default' => 10,
             ));
    }

    public function setUp()
    {
        parent::setUp();
        $this->hasMany('ProductProp as Prop', array(
             'refClass' => 'ProductPropValue',
             'local' => 'id',
             'foreign' => 'product_id'));

        $this->hasMany('Cat as Cats', array(
             'refClass' => 'CatProduct',
             'local' => 'product_id',
             'foreign' => 'cat_id'));

        $this->hasOne('Suppliers', array(
             'local' => 'supplier_id',
             'foreign' => 'id',
             'onDelete' => 'CASCADE'));

        $this->hasMany('Tag as Tags', array(
             'refClass' => 'ProductTags',
             'local' => 'product_id',
             'foreign' => 'tag_id',
             'onDelete' => 'CASCADE'));

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

        $this->hasMany('ProductTags', array(
             'local' => 'id',
             'foreign' => 'product_id'));

        $this->hasMany('ProductPropValue', array(
             'local' => 'id',
             'foreign' => 'product_id'));

        $this->hasMany('Offer', array(
             'local' => 'id',
             'foreign' => 'product_id'));

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