# Source for file Column.php

Documentation is available at Column.php

1. <?php
2. /*
3. * $Id: Column.php 1080 2007-02-10 18:17:08Z romanb $
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. * @package Doctrine
24. * @url http://www.phpdoctrine.com
25. * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
26. * @author Jukka Hassinen <Jukka.Hassinen@BrainAlliance.com>
27. * @version $Id: Column.php 1080 2007-02-10 18:17:08Z romanb $
28. */
29. /**
30. * class Doctrine_Schema_Column
31. * Holds information on a database table field
32. * @package Doctrine
33. * @category Object Relational Mapping
34. * @link www.phpdoctrine.com
35. * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
36. * @since 1.0
37. * @version $Revision: 1080 $
38. * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
39. */
40. class Doctrine_Schema_Column extends Doctrine_Schema_Object implements IteratorAggregate
41. {
42. /**
43. * column definitions
44. * @var array $definition
45. */
46. protected $definition = array('name' => '',
47. 'type' => '',
48. 'length' => null,
49. 'unique' => false,
50. 'primary' => false,
51. 'notnull' => false,
52. 'default' => false,
53. 'autoinc' => false
54. );
56. public function getName()
57. {
58. return $this->definition['name'];
59. }
60. public function getType()
61. {
62. return $this->definition['type'];
63. }
64. public function isUnique()
65. {
66. return $this->definition['unique'];
67. }
68. public function isPrimaryKey()
69. {
70. return $this->definition['primary'];
71. }
72. public function defaultValue()
73. {
74. return $this->definition['default'];
75. }
76. public function isNotNull()
77. {
78. return $this->definition['notnull'];
79. }
80. }