| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Rougin\Describe; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * Column Class | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * Stores a column information from the results given. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * @package Describe | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * @author  Rougin Royce Gutib <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | class Column | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |      * @var boolean | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |     protected $autoIncrement = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |     protected $dataType = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |     protected $defaultValue = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     protected $field = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |      * @var boolean | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     protected $foreign = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |      * @var integer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     protected $length = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |      * @var boolean | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |     protected $null = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |      * @var boolean | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |     protected $primary = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |     protected $referencedField = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |     protected $referencedTable = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |      * @var boolean | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |     protected $unique = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |      * @var boolean | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |     protected $unsigned = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |      * Gets the data type. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 | 3 |  |     public function getDataType() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 | 3 |  |         return $this->dataType; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |      * Gets the default value. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 | 3 |  |     public function getDefaultValue() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 | 3 |  |         return $this->defaultValue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |      * Gets the column description. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 | 18 |  |     public function getField() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 | 18 |  |         return $this->field; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |      * Gets the foreign field. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 | 3 |  |     public function getReferencedField() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 | 3 |  |         return $this->referencedField; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |      * Gets the foreign table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 | 3 |  |     public function getReferencedTable() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 | 3 |  |         return $this->referencedTable; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |      * Gets the field's length. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |      * @return integer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 | 3 |  |     public function getLength() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 | 3 |  |         return $this->length; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |      * Check if the field is an auto incrementing field. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |      * @return boolean | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 | 3 |  |     public function isAutoIncrement() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 | 3 |  |         return $this->autoIncrement; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |      * Check if the field is a foreign key. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |      * @return boolean | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 | 3 |  |     public function isForeignKey() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 | 3 |  |         return $this->foreign; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |      * Check if the field accept NULL values. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |      * @return boolean | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 | 3 |  |     public function isNull() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 | 3 |  |         return $this->null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |      * Check if the field is a primary key. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |      * @return boolean | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 169 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 170 | 15 |  |     public function isPrimaryKey() | 
            
                                                                        
                            
            
                                    
            
            
                | 171 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 172 | 15 |  |         return $this->primary; | 
            
                                                                        
                            
            
                                    
            
            
                | 173 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |      * Check if field is unique. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |      * @return boolean | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 | 3 |  |     public function isUnique() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 | 3 |  |         return $this->unique; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |      * Check if field is unsigned. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |      * @return boolean | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 | 3 |  |     public function isUnsigned() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 | 3 |  |         return $this->unsigned; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |      * Sets the auto increment. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |      * @param boolean $autoIncrement | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 | 57 |  |     public function setAutoIncrement($autoIncrement) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 | 57 |  |         $this->autoIncrement = $autoIncrement; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 | 57 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |      * Sets the data type. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |      * @param string $dataType | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 | 57 |  |     public function setDataType($dataType) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 | 57 |  |         $dataTypes = [ 'integer', 'string', 'string' ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 | 57 |  |         $shortHand = [ 'int', 'varchar', 'text' ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 | 57 |  |         $index = array_search($dataType, $shortHand); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 | 57 |  |         $this->dataType = ($index === false) ? $dataType : $dataTypes[$index]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 | 57 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |      * Sets the default value. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |      * @param string $defaultValue | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 | 57 |  |     public function setDefaultValue($defaultValue) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 | 57 |  |         $this->defaultValue = $defaultValue; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 | 57 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |      * Sets the column's description. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |      * @param string $field | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 | 57 |  |     public function setField($field) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 | 57 |  |         $this->field = $field; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 | 57 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |      * Sets the field as a foreign key. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |      * @param boolean $foreign | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 | 57 |  |     public function setForeign($foreign) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 | 57 |  |         $this->foreign = $foreign; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 | 57 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |      * Sets the foreign field. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |      * @param string $referencedField | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 | 57 |  |     public function setReferencedField($referencedField) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 | 57 |  |         $this->referencedField = $referencedField; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 | 57 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |      * Sets the foreign table. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |      * @param string $foreignTable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 | 57 |  |     public function setReferencedTable($foreignTable) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 | 57 |  |         $this->referencedTable = $foreignTable; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 | 57 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |      * Sets the field's length. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |      * @param integer $length | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 | 45 |  |     public function setLength($length) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 | 45 |  |         $this->length = $length; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 | 45 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |      * Sets if field accepts NULL values. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |      * @param boolean $null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 | 57 |  |     public function setNull($null = true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 | 57 |  |         $this->null = $null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 | 57 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |      * Sets if field is a primary key. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |      * @param boolean $primary | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 | 57 |  |     public function setPrimary($primary = true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 | 57 |  |         $this->primary = $primary; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 | 57 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |      * Sets if field is a unique key. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |      * @param boolean $unique | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 | 45 |  |     public function setUnique($unique = true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 | 45 |  |         $this->unique = $unique; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 | 45 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |      * Sets if field is an unsigned key. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |      * @param boolean $unsigned | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 | 3 |  |     public function setUnsigned($unsigned = true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 | 3 |  |         $this->unsigned = $unsigned; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 | 3 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |      * Calls methods from this class in underscore case. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |      * @param  string $method | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |      * @param  mixed  $parameters | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 | 33 |  |     public function __call($method, $parameters) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 | 33 |  |         return MagicMethodHelper::call($this, $method, $parameters); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 353 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 354 |  |  |  |