BaseArticle.class.php 3.76 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
<?php

/**
 * BaseArticle
 * 
 * This class has been auto-generated by the Doctrine ORM Framework
 * 
 * @property string $alias
 * @property string $title
 * @property string $cover
 * @property text $description
 * @property text $body
 * @property boolean $available
 * @property Doctrine_Collection $Tags
 * @property Doctrine_Collection $ArticleTags
 * 
 * @method string              getAlias()       Returns the current record's "alias" value
 * @method string              getTitle()       Returns the current record's "title" value
 * @method string              getCover()       Returns the current record's "cover" value
 * @method text                getDescription() Returns the current record's "description" value
 * @method text                getBody()        Returns the current record's "body" value
 * @method boolean             getAvailable()   Returns the current record's "available" value
 * @method Doctrine_Collection getTags()        Returns the current record's "Tags" collection
 * @method Doctrine_Collection getArticleTags() Returns the current record's "ArticleTags" collection
 * @method Article             setAlias()       Sets the current record's "alias" value
 * @method Article             setTitle()       Sets the current record's "title" value
 * @method Article             setCover()       Sets the current record's "cover" value
 * @method Article             setDescription() Sets the current record's "description" value
 * @method Article             setBody()        Sets the current record's "body" value
 * @method Article             setAvailable()   Sets the current record's "available" value
 * @method Article             setTags()        Sets the current record's "Tags" collection
 * @method Article             setArticleTags() Sets the current record's "ArticleTags" collection
 * 
 * @package    sf
 * @subpackage model
 * @author     Atma
 * @version    SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
 */
abstract class BaseArticle extends sfDoctrineRecord
{
    public function setTableDefinition()
    {
        $this->setTableName('article');
        $this->hasColumn('alias', 'string', 255, array(
             'type' => 'string',
             'notnull' => true,
             'unique' => true,
             'length' => 255,
             ));
        $this->hasColumn('title', 'string', 512, array(
             'type' => 'string',
             'notnull' => true,
             'length' => 512,
             ));
        $this->hasColumn('cover', 'string', 255, array(
             'type' => 'string',
             'notnull' => true,
             'length' => 255,
             ));
        $this->hasColumn('description', 'text', null, array(
             'type' => 'text',
             'notnull' => true,
             ));
        $this->hasColumn('body', 'text', null, array(
             'type' => 'text',
             'notnull' => true,
             ));
        $this->hasColumn('available', 'boolean', null, array(
             'type' => 'boolean',
             'default' => 0,
             ));
    }

    public function setUp()
    {
        parent::setUp();
        $this->hasMany('Tag as Tags', array(
             'refClass' => 'ArticleTags',
             'local' => 'article_id',
             'foreign' => 'tag_id',
             'onDelete' => 'CASCADE'));

        $this->hasMany('ArticleTags', array(
             'local' => 'id',
             'foreign' => 'article_id'));

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