1 |
<?php
|
2 |
/*
|
3 |
* $Id: Column.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $
|
4 |
*
|
5 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
6 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
7 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
8 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
9 |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
10 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
11 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
12 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
13 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
14 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
15 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
16 |
*
|
17 |
* This software consists of voluntary contributions made by many individuals
|
18 |
* and is licensed under the LGPL. For more information, see
|
19 |
* <http://www.phpdoctrine.com>.
|
20 |
*/
|
21 |
Doctrine::autoload('Doctrine_Schema_Object');
|
22 |
/**
|
23 |
* class Doctrine_Schema_Column
|
24 |
* Holds information on a database table field
|
25 |
*
|
26 |
* @package Doctrine
|
27 |
* @subpackage Schema
|
28 |
* @link www.phpdoctrine.com
|
29 |
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
30 |
* @since 1.0
|
31 |
* @version $Revision: 2702 $
|
32 |
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
33 |
* @author Jukka Hassinen <Jukka.Hassinen@BrainAlliance.com>
|
34 |
*/
|
35 |
class Doctrine_Schema_Column extends Doctrine_Schema_Object implements IteratorAggregate
|
36 |
{
|
37 |
/**
|
38 |
* column definitions
|
39 |
* @var array $definition
|
40 |
*/
|
41 |
protected $definition = array('name' => '',
|
42 |
'type' => '',
|
43 |
'length' => null,
|
44 |
'unique' => false,
|
45 |
'primary' => false,
|
46 |
'notnull' => false,
|
47 |
'default' => false,
|
48 |
'autoinc' => false
|
49 |
);
|
50 |
|
51 |
public function getName()
|
52 |
{
|
53 |
return $this->definition['name'];
|
54 |
}
|
55 |
public function getType()
|
56 |
{
|
57 |
return $this->definition['type'];
|
58 |
}
|
59 |
public function isUnique()
|
60 |
{
|
61 |
return $this->definition['unique'];
|
62 |
}
|
63 |
public function isPrimaryKey()
|
64 |
{
|
65 |
return $this->definition['primary'];
|
66 |
}
|
67 |
public function defaultValue()
|
68 |
{
|
69 |
return $this->definition['default'];
|
70 |
}
|
71 |
public function isNotNull()
|
72 |
{
|
73 |
return $this->definition['notnull'];
|
74 |
}
|
75 |
}
|