root/trunk/lib/model/map/SnippetSnippetMapBuilder.php

Revision 2, 2.3 kB (checked in by fabien, 6 years ago)

initial import

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 <?php
2         
3 require_once 'propel/map/MapBuilder.php';
4 include_once 'creole/CreoleTypes.php';
5
6
7 /**
8  * This class adds structure of 'sn_snippet' table to 'propel' DatabaseMap object.
9  *
10  *
11  *
12  * These statically-built map classes are used by Propel to do runtime db structure discovery.
13  * For example, the createSelectSql() method checks the type of a given column used in an
14  * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
15  * (i.e. if it's a text column type).
16  *
17  * @package model.map
18  */   
19 class SnippetSnippetMapBuilder {
20
21     /**
22      * The (dot-path) name of this class
23      */
24     const CLASS_NAME = 'model.map.SnippetSnippetMapBuilder';   
25
26     /**
27      * The database map.
28      */
29     private $dbMap;
30
31     /**
32      * Tells us if this DatabaseMapBuilder is built so that we
33      * don't have to re-build it every time.
34      *
35      * @return boolean true if this DatabaseMapBuilder is built, false otherwise.
36      */
37     public function isBuilt()
38     {
39         return ($this->dbMap !== null);
40     }
41
42     /**
43      * Gets the databasemap this map builder built.
44      *
45      * @return the databasemap
46      */
47     public function getDatabaseMap()
48     {
49         return $this->dbMap;
50     }
51
52     /**
53      * The doBuild() method builds the DatabaseMap
54      *
55      * @return void
56      * @throws PropelException
57      */
58     public function doBuild()
59     {
60         $this->dbMap = Propel::getDatabaseMap('propel');
61         
62         $tMap = $this->dbMap->addTable('sn_snippet');
63         $tMap->setPhpName('SnippetSnippet');
64
65         $tMap->setUseIdGenerator(true);
66
67         $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null);
68
69         $tMap->addForeignKey('USER_ID', 'UserId', 'int', CreoleTypes::INTEGER, 'sn_user', 'ID', false, null);
70
71         $tMap->addColumn('TITLE', 'Title', 'string', CreoleTypes::LONGVARCHAR, false);
72
73         $tMap->addColumn('BODY', 'Body', 'string', CreoleTypes::LONGVARCHAR, false);
74
75         $tMap->addColumn('HTML_BODY', 'HtmlBody', 'string', CreoleTypes::LONGVARCHAR, false);
76
77         $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false);
78
79         $tMap->addColumn('AVERAGE_VOTE', 'AverageVote', 'double', CreoleTypes::DOUBLE, false);
80
81         $tMap->addColumn('NB_COMMENTS', 'NbComments', 'int', CreoleTypes::INTEGER, false);
82
83         $tMap->addColumn('ALL_TAGS', 'AllTags', 'string', CreoleTypes::VARCHAR, false);
84                 
85     } // doBuild()
86
87 } // SnippetSnippetMapBuilder
88
Note: See TracBrowser for help on using the browser.