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

Revision 2, 2.0 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_vote' 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 SnippetVoteMapBuilder {
20
21     /**
22      * The (dot-path) name of this class
23      */
24     const CLASS_NAME = 'model.map.SnippetVoteMapBuilder';   
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_vote');
63         $tMap->setPhpName('SnippetVote');
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->addForeignKey('SNIPPET_ID', 'SnippetId', 'int', CreoleTypes::INTEGER, 'sn_snippet', 'ID', false, null);
72
73         $tMap->addColumn('VOTE', 'Vote', 'int', CreoleTypes::INTEGER, false);
74
75         $tMap->addColumn('CREATED_AT', 'CreatedAt', 'int', CreoleTypes::TIMESTAMP, false);
76                 
77     } // doBuild()
78
79 } // SnippetVoteMapBuilder
80
Note: See TracBrowser for help on using the browser.