@@ -55,6 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * @param string a unique identifier for the <parameterMap>. |
| 58 | + * @param string $value |
|
| 58 | 59 | */ |
| 59 | 60 | public function setID($value) |
| 60 | 61 | { |
@@ -62,7 +63,7 @@ discard block |
||
| 62 | 63 | } |
| 63 | 64 | |
| 64 | 65 | /** |
| 65 | - * @return TParameterProperty[] list of properties for the parameter map. |
|
| 66 | + * @return TList list of properties for the parameter map. |
|
| 66 | 67 | */ |
| 67 | 68 | public function getProperties() |
| 68 | 69 | { |
@@ -112,6 +113,7 @@ discard block |
||
| 112 | 113 | /** |
| 113 | 114 | * @param int parameter property index |
| 114 | 115 | * @param TParameterProperty new parameter property. |
| 116 | + * @param integer $index |
|
| 115 | 117 | */ |
| 116 | 118 | public function insertProperty($index, TParameterProperty $property) |
| 117 | 119 | { |
@@ -177,8 +177,7 @@ |
||
| 177 | 177 | try |
| 178 | 178 | { |
| 179 | 179 | return TPropertyAccess::get($object, $property->getProperty()); |
| 180 | - } |
|
| 181 | - catch (TInvalidPropertyException $e) |
|
| 180 | + } catch (TInvalidPropertyException $e) |
|
| 182 | 181 | { |
| 183 | 182 | throw new TSqlMapException( |
| 184 | 183 | 'sqlmap_unable_to_get_property_for_parameter', |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function __construct() |
| 43 | 43 | { |
| 44 | - $this->_properties = new TList; |
|
| 45 | - $this->_propertyMap = new TMap; |
|
| 44 | + $this->_properties=new TList; |
|
| 45 | + $this->_propertyMap=new TMap; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function setExtends($value) |
| 84 | 84 | { |
| 85 | - $this->_extend = $value; |
|
| 85 | + $this->_extend=$value; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -136,15 +136,15 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function getPropertyValue($registry, $property, $parameterValue) |
| 138 | 138 | { |
| 139 | - $value = $this->getObjectValue($parameterValue,$property); |
|
| 139 | + $value=$this->getObjectValue($parameterValue, $property); |
|
| 140 | 140 | |
| 141 | 141 | if(($handler=$this->createTypeHandler($property, $registry))!==null) |
| 142 | - $value = $handler->getParameter($value); |
|
| 142 | + $value=$handler->getParameter($value); |
|
| 143 | 143 | |
| 144 | - $value = $this->nullifyDefaultValue($property,$value); |
|
| 144 | + $value=$this->nullifyDefaultValue($property, $value); |
|
| 145 | 145 | |
| 146 | - if(($type = $property->getType())!==null) |
|
| 147 | - $value = $registry->convertToType($type, $value); |
|
| 146 | + if(($type=$property->getType())!==null) |
|
| 147 | + $value=$registry->convertToType($type, $value); |
|
| 148 | 148 | |
| 149 | 149 | return $value; |
| 150 | 150 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $type=$property->getTypeHandler() ? $property->getTypeHandler() : $property->getType(); |
| 162 | 162 | $handler=$registry->getTypeHandler($type); |
| 163 | 163 | if($handler===null && $property->getTypeHandler()) |
| 164 | - $handler = Prado::createComponent($type); |
|
| 164 | + $handler=Prado::createComponent($type); |
|
| 165 | 165 | return $handler; |
| 166 | 166 | } |
| 167 | 167 | |
@@ -172,13 +172,13 @@ discard block |
||
| 172 | 172 | * @return mixed property value. |
| 173 | 173 | * @throws TSqlMapException if property access is invalid. |
| 174 | 174 | */ |
| 175 | - protected function getObjectValue($object,$property) |
|
| 175 | + protected function getObjectValue($object, $property) |
|
| 176 | 176 | { |
| 177 | 177 | try |
| 178 | 178 | { |
| 179 | 179 | return TPropertyAccess::get($object, $property->getProperty()); |
| 180 | 180 | } |
| 181 | - catch (TInvalidPropertyException $e) |
|
| 181 | + catch(TInvalidPropertyException $e) |
|
| 182 | 182 | { |
| 183 | 183 | throw new TSqlMapException( |
| 184 | 184 | 'sqlmap_unable_to_get_property_for_parameter', |
@@ -196,12 +196,12 @@ discard block |
||
| 196 | 196 | * @param mixed current property value |
| 197 | 197 | * @return mixed null if NullValue matches currrent value. |
| 198 | 198 | */ |
| 199 | - protected function nullifyDefaultValue($property,$value) |
|
| 199 | + protected function nullifyDefaultValue($property, $value) |
|
| 200 | 200 | { |
| 201 | - if(($nullValue = $property->getNullValue())!==null) |
|
| 201 | + if(($nullValue=$property->getNullValue())!==null) |
|
| 202 | 202 | { |
| 203 | - if($nullValue === $value) |
|
| 204 | - $value = null; |
|
| 203 | + if($nullValue===$value) |
|
| 204 | + $value=null; |
|
| 205 | 205 | } |
| 206 | 206 | return $value; |
| 207 | 207 | } |
@@ -103,6 +103,7 @@ discard block |
||
| 103 | 103 | /** |
| 104 | 104 | * @param string name of the column in the result set from which the value |
| 105 | 105 | * will be used to populate the property. |
| 106 | + * @param string $value |
|
| 106 | 107 | */ |
| 107 | 108 | public function setColumn($value) |
| 108 | 109 | { |
@@ -121,6 +122,7 @@ discard block |
||
| 121 | 122 | /** |
| 122 | 123 | * @param int index of the column in the ResultSet from which the value will |
| 123 | 124 | * be used to populate the object property |
| 125 | + * @param integer $value |
|
| 124 | 126 | */ |
| 125 | 127 | public function setColumnIndex($value) |
| 126 | 128 | { |
@@ -185,6 +187,7 @@ discard block |
||
| 185 | 187 | |
| 186 | 188 | /** |
| 187 | 189 | * @param string custom type handler class name (may use namespace). |
| 190 | + * @param string $value |
|
| 188 | 191 | */ |
| 189 | 192 | public function setTypeHandler($value) |
| 190 | 193 | { |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | private $_hostResultMapID='inplicit internal mapping'; |
| 48 | 48 | |
| 49 | - const LIST_TYPE = 0; |
|
| 50 | - const ARRAY_TYPE = 1; |
|
| 49 | + const LIST_TYPE=0; |
|
| 50 | + const ARRAY_TYPE=1; |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * Gets the containing result map ID. |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | public function __construct($resultMap=null) |
| 57 | 57 | { |
| 58 | 58 | if($resultMap instanceof TResultMap) |
| 59 | - $this->_hostResultMapID = $resultMap->getID(); |
|
| 59 | + $this->_hostResultMapID=$resultMap->getID(); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function setNullValue($value) |
| 74 | 74 | { |
| 75 | - $this->_nullValue = $value; |
|
| 75 | + $this->_nullValue=$value; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function setProperty($value) |
| 90 | 90 | { |
| 91 | - $this->_propertyName = $value; |
|
| 91 | + $this->_propertyName=$value; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function setColumn($value) |
| 108 | 108 | { |
| 109 | - $this->_columnName = $value; |
|
| 109 | + $this->_columnName=$value; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | public function setColumnIndex($value) |
| 126 | 126 | { |
| 127 | - $this->_columnIndex = TPropertyValue::ensureInteger($value); |
|
| 127 | + $this->_columnIndex=TPropertyValue::ensureInteger($value); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public function setResultMapping($value) |
| 142 | 142 | { |
| 143 | - $this->_nestedResultMapName = $value; |
|
| 143 | + $this->_nestedResultMapName=$value; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function setNestedResultMap($value) |
| 158 | 158 | { |
| 159 | - $this->_nestedResultMap = $value; |
|
| 159 | + $this->_nestedResultMap=$value; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | public function setType($value) |
| 174 | 174 | { |
| 175 | - $this->_valueType = $value; |
|
| 175 | + $this->_valueType=$value; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function setTypeHandler($value) |
| 190 | 190 | { |
| 191 | - $this->_typeHandler = $value; |
|
| 191 | + $this->_typeHandler=$value; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function setSelect($value) |
| 208 | 208 | { |
| 209 | - $this->_select = $value; |
|
| 209 | + $this->_select=$value; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public function setLazyLoad($value) |
| 224 | 224 | { |
| 225 | - $this->_isLazyLoad = TPropertyValue::ensureBoolean($value,false); |
|
| 225 | + $this->_isLazyLoad=TPropertyValue::ensureBoolean($value, false); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
@@ -231,17 +231,17 @@ discard block |
||
| 231 | 231 | * @param array result row |
| 232 | 232 | * @return mixed property value. |
| 233 | 233 | */ |
| 234 | - public function getPropertyValue($registry,$row) |
|
| 234 | + public function getPropertyValue($registry, $row) |
|
| 235 | 235 | { |
| 236 | - $value = null; |
|
| 237 | - $index = $this->getColumnIndex(); |
|
| 238 | - $name = $this->getColumn(); |
|
| 236 | + $value=null; |
|
| 237 | + $index=$this->getColumnIndex(); |
|
| 238 | + $name=$this->getColumn(); |
|
| 239 | 239 | if($index > 0 && isset($row[$index])) |
| 240 | - $value = $this->getTypedValue($registry,$row[$index]); |
|
| 240 | + $value=$this->getTypedValue($registry, $row[$index]); |
|
| 241 | 241 | else if(isset($row[$name])) |
| 242 | - $value = $this->getTypedValue($registry,$row[$name]); |
|
| 242 | + $value=$this->getTypedValue($registry, $row[$name]); |
|
| 243 | 243 | if(($value===null) && ($this->getNullValue()!==null)) |
| 244 | - $value = $this->getTypedValue($registry,$this->getNullValue()); |
|
| 244 | + $value=$this->getTypedValue($registry, $this->getNullValue()); |
|
| 245 | 245 | return $value; |
| 246 | 246 | } |
| 247 | 247 | |
@@ -250,9 +250,9 @@ discard block |
||
| 250 | 250 | * @param mixed raw property value |
| 251 | 251 | * @return mixed property value casted to specific type. |
| 252 | 252 | */ |
| 253 | - protected function getTypedValue($registry,$value) |
|
| 253 | + protected function getTypedValue($registry, $value) |
|
| 254 | 254 | { |
| 255 | - if(($handler = $this->createTypeHandler($registry))!==null) |
|
| 255 | + if(($handler=$this->createTypeHandler($registry))!==null) |
|
| 256 | 256 | return $handler->getResult($value); |
| 257 | 257 | else |
| 258 | 258 | return $registry->convertToType($this->getType(), $value); |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | $type=$this->getTypeHandler() ? $this->getTypeHandler() : $this->getType(); |
| 269 | 269 | $handler=$registry->getTypeHandler($type); |
| 270 | 270 | if($handler===null && $this->getTypeHandler()) |
| 271 | - $handler = Prado::createComponent($type); |
|
| 271 | + $handler=Prado::createComponent($type); |
|
| 272 | 272 | return $handler; |
| 273 | 273 | } |
| 274 | 274 | |
@@ -278,17 +278,17 @@ discard block |
||
| 278 | 278 | */ |
| 279 | 279 | protected function getPropertyValueType() |
| 280 | 280 | { |
| 281 | - if(class_exists($type = $this->getType(), false)) //NO force autoloading |
|
| 281 | + if(class_exists($type=$this->getType(), false)) //NO force autoloading |
|
| 282 | 282 | { |
| 283 | 283 | if($type==='TList') |
| 284 | 284 | return self::LIST_TYPE; |
| 285 | - $class = new ReflectionClass($type); |
|
| 285 | + $class=new ReflectionClass($type); |
|
| 286 | 286 | if($class->isSubclassOf('TList')) |
| 287 | 287 | return self::LIST_TYPE; |
| 288 | 288 | if($class->implementsInterface('ArrayAccess')) |
| 289 | 289 | return self::ARRAY_TYPE; |
| 290 | 290 | } |
| 291 | - if(strtolower($type) == 'array') |
|
| 291 | + if(strtolower($type)=='array') |
|
| 292 | 292 | return self::ARRAY_TYPE; |
| 293 | 293 | } |
| 294 | 294 | |
@@ -301,8 +301,8 @@ discard block |
||
| 301 | 301 | public function instanceOfListType($target) |
| 302 | 302 | { |
| 303 | 303 | if($this->getType()===null) |
| 304 | - return TPropertyAccess::get($target,$this->getProperty()) instanceof TList; |
|
| 305 | - return $this->getPropertyValueType() == self::LIST_TYPE; |
|
| 304 | + return TPropertyAccess::get($target, $this->getProperty()) instanceof TList; |
|
| 305 | + return $this->getPropertyValueType()==self::LIST_TYPE; |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
@@ -315,28 +315,28 @@ discard block |
||
| 315 | 315 | { |
| 316 | 316 | if($this->getType()===null) |
| 317 | 317 | { |
| 318 | - $prop = TPropertyAccess::get($target,$this->getProperty()); |
|
| 318 | + $prop=TPropertyAccess::get($target, $this->getProperty()); |
|
| 319 | 319 | if(is_object($prop)) |
| 320 | 320 | return $prop instanceof ArrayAccess; |
| 321 | 321 | return is_array($prop); |
| 322 | 322 | } |
| 323 | - return $this->getPropertyValueType() == self::ARRAY_TYPE; |
|
| 323 | + return $this->getPropertyValueType()==self::ARRAY_TYPE; |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | public function __sleep() |
| 327 | 327 | { |
| 328 | - $exprops = array(); $cn = 'TResultProperty'; |
|
| 329 | - if ($this->_nullValue===null) $exprops[] = "\0$cn\0_nullValue"; |
|
| 330 | - if ($this->_propertyName===null) $exprops[] = "\0$cn\0_propertyNama"; |
|
| 331 | - if ($this->_columnName===null) $exprops[] = "\0$cn\0_columnName"; |
|
| 332 | - if ($this->_columnIndex==-1) $exprops[] = "\0$cn\0_columnIndex"; |
|
| 333 | - if ($this->_nestedResultMapName===null) $exprops[] = "\0$cn\0_nestedResultMapName"; |
|
| 334 | - if ($this->_nestedResultMap===null) $exprops[] = "\0$cn\0_nestedResultMap"; |
|
| 335 | - if ($this->_valueType===null) $exprops[] = "\0$cn\0_valueType"; |
|
| 336 | - if ($this->_typeHandler===null) $exprops[] = "\0$cn\0_typeHandler"; |
|
| 337 | - if ($this->_isLazyLoad===false) $exprops[] = "\0$cn\0_isLazyLoad"; |
|
| 338 | - if ($this->_select===null) $exprops[] = "\0$cn\0_select"; |
|
| 339 | - return array_diff(parent::__sleep(),$exprops); |
|
| 328 | + $exprops=array(); $cn='TResultProperty'; |
|
| 329 | + if($this->_nullValue===null) $exprops[]="\0$cn\0_nullValue"; |
|
| 330 | + if($this->_propertyName===null) $exprops[]="\0$cn\0_propertyNama"; |
|
| 331 | + if($this->_columnName===null) $exprops[]="\0$cn\0_columnName"; |
|
| 332 | + if($this->_columnIndex==-1) $exprops[]="\0$cn\0_columnIndex"; |
|
| 333 | + if($this->_nestedResultMapName===null) $exprops[]="\0$cn\0_nestedResultMapName"; |
|
| 334 | + if($this->_nestedResultMap===null) $exprops[]="\0$cn\0_nestedResultMap"; |
|
| 335 | + if($this->_valueType===null) $exprops[]="\0$cn\0_valueType"; |
|
| 336 | + if($this->_typeHandler===null) $exprops[]="\0$cn\0_typeHandler"; |
|
| 337 | + if($this->_isLazyLoad===false) $exprops[]="\0$cn\0_isLazyLoad"; |
|
| 338 | + if($this->_select===null) $exprops[]="\0$cn\0_select"; |
|
| 339 | + return array_diff(parent::__sleep(), $exprops); |
|
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | 342 | |
@@ -268,6 +268,7 @@ |
||
| 268 | 268 | * @param TSqlMapTypeHandlerRegistry type handler registry |
| 269 | 269 | * @param string result class name. |
| 270 | 270 | * @param array result data. |
| 271 | + * @param string $type |
|
| 271 | 272 | * @return mixed result object. |
| 272 | 273 | */ |
| 273 | 274 | protected function createInstanceOf($registry,$type,$row=null) |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function setParameterMap($value) |
| 77 | 77 | { |
| 78 | - $this->_parameterMapName = $value; |
|
| 78 | + $this->_parameterMapName=$value; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function setParameterClass($value) |
| 96 | 96 | { |
| 97 | - $this->_parameterClassName = $value; |
|
| 97 | + $this->_parameterClassName=$value; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public function setResultMap($value) |
| 114 | 114 | { |
| 115 | - $this->_resultMapName = $value; |
|
| 115 | + $this->_resultMapName=$value; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | public function setResultClass($value) |
| 135 | 135 | { |
| 136 | - $this->_resultClassName = $value; |
|
| 136 | + $this->_resultClassName=$value; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function setCacheModel($value) |
| 151 | 151 | { |
| 152 | - $this->_cacheModelName = $value; |
|
| 152 | + $this->_cacheModelName=$value; |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function setCache($value) |
| 167 | 167 | { |
| 168 | - $this->_cache = $value; |
|
| 168 | + $this->_cache=$value; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public function setSqlText($value) |
| 183 | 183 | { |
| 184 | - $this->_SQL = $value; |
|
| 184 | + $this->_SQL=$value; |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | /** |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | */ |
| 199 | 199 | public function setListClass($value) |
| 200 | 200 | { |
| 201 | - $this->_listClass = $value; |
|
| 201 | + $this->_listClass=$value; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /** |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | public function setExtends($value) |
| 216 | 216 | { |
| 217 | - $this->_extendStatement = $value; |
|
| 217 | + $this->_extendStatement=$value; |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | public function setInlineParameterMap($map) |
| 242 | 242 | { |
| 243 | - $this->_parameterMap = $map; |
|
| 243 | + $this->_parameterMap=$map; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
@@ -249,9 +249,9 @@ discard block |
||
| 249 | 249 | public function initialize($manager) |
| 250 | 250 | { |
| 251 | 251 | if(strlen($this->_resultMapName) > 0) |
| 252 | - $this->_resultMap = $manager->getResultMap($this->_resultMapName); |
|
| 252 | + $this->_resultMap=$manager->getResultMap($this->_resultMapName); |
|
| 253 | 253 | if(strlen($this->_parameterMapName) > 0) |
| 254 | - $this->_parameterMap = $manager->getParameterMap($this->_parameterMapName); |
|
| 254 | + $this->_parameterMap=$manager->getParameterMap($this->_parameterMapName); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | /** |
@@ -260,8 +260,8 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | public function createInstanceOfListClass($registry) |
| 262 | 262 | { |
| 263 | - if(strlen($type = $this->getListClass()) > 0) |
|
| 264 | - return $this->createInstanceOf($registry,$type); |
|
| 263 | + if(strlen($type=$this->getListClass()) > 0) |
|
| 264 | + return $this->createInstanceOf($registry, $type); |
|
| 265 | 265 | return array(); |
| 266 | 266 | } |
| 267 | 267 | |
@@ -272,9 +272,9 @@ discard block |
||
| 272 | 272 | * @param array result data. |
| 273 | 273 | * @return mixed result object. |
| 274 | 274 | */ |
| 275 | - protected function createInstanceOf($registry,$type,$row=null) |
|
| 275 | + protected function createInstanceOf($registry, $type, $row=null) |
|
| 276 | 276 | { |
| 277 | - $handler = $registry->getTypeHandler($type); |
|
| 277 | + $handler=$registry->getTypeHandler($type); |
|
| 278 | 278 | if($handler!==null) |
| 279 | 279 | return $handler->createNewInstance($row); |
| 280 | 280 | else |
@@ -287,30 +287,30 @@ discard block |
||
| 287 | 287 | * @param array result data. |
| 288 | 288 | * @return mixed result object. |
| 289 | 289 | */ |
| 290 | - public function createInstanceOfResultClass($registry,$row) |
|
| 290 | + public function createInstanceOfResultClass($registry, $row) |
|
| 291 | 291 | { |
| 292 | - if(strlen($type= $this->getResultClass()) > 0) |
|
| 293 | - return $this->createInstanceOf($registry,$type,$row); |
|
| 292 | + if(strlen($type=$this->getResultClass()) > 0) |
|
| 293 | + return $this->createInstanceOf($registry, $type, $row); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | public function __sleep() |
| 297 | 297 | { |
| 298 | - $cn = __CLASS__; |
|
| 299 | - $exprops = array("\0$cn\0_resultMap"); |
|
| 300 | - if (!$this->_parameterMapName) $exprops[] = "\0$cn\0_parameterMapName"; |
|
| 301 | - if (!$this->_parameterMap) $exprops[] = "\0$cn\0_parameterMap"; |
|
| 302 | - if (!$this->_parameterClassName) $exprops[] = "\0$cn\0_parameterClassName"; |
|
| 303 | - if (!$this->_resultMapName) $exprops[] = "\0$cn\0_resultMapName"; |
|
| 304 | - if (!$this->_resultMap) $exprops[] = "\0$cn\0_resultMap"; |
|
| 305 | - if (!$this->_resultClassName) $exprops[] = "\0$cn\0_resultClassName"; |
|
| 306 | - if (!$this->_cacheModelName) $exprops[] = "\0$cn\0_cacheModelName"; |
|
| 307 | - if (!$this->_SQL) $exprops[] = "\0$cn\0_SQL"; |
|
| 308 | - if (!$this->_listClass) $exprops[] = "\0$cn\0_listClass"; |
|
| 309 | - if (!$this->_typeHandler) $exprops[] = "\0$cn\0_typeHandler"; |
|
| 310 | - if (!$this->_extendStatement) $exprops[] = "\0$cn\0_extendStatement"; |
|
| 311 | - if (!$this->_cache) $exprops[] = "\0$cn\0_cache"; |
|
| 312 | - |
|
| 313 | - return array_diff(parent::__sleep(),$exprops); |
|
| 298 | + $cn=__CLASS__; |
|
| 299 | + $exprops=array("\0$cn\0_resultMap"); |
|
| 300 | + if(!$this->_parameterMapName) $exprops[]="\0$cn\0_parameterMapName"; |
|
| 301 | + if(!$this->_parameterMap) $exprops[]="\0$cn\0_parameterMap"; |
|
| 302 | + if(!$this->_parameterClassName) $exprops[]="\0$cn\0_parameterClassName"; |
|
| 303 | + if(!$this->_resultMapName) $exprops[]="\0$cn\0_resultMapName"; |
|
| 304 | + if(!$this->_resultMap) $exprops[]="\0$cn\0_resultMap"; |
|
| 305 | + if(!$this->_resultClassName) $exprops[]="\0$cn\0_resultClassName"; |
|
| 306 | + if(!$this->_cacheModelName) $exprops[]="\0$cn\0_cacheModelName"; |
|
| 307 | + if(!$this->_SQL) $exprops[]="\0$cn\0_SQL"; |
|
| 308 | + if(!$this->_listClass) $exprops[]="\0$cn\0_listClass"; |
|
| 309 | + if(!$this->_typeHandler) $exprops[]="\0$cn\0_typeHandler"; |
|
| 310 | + if(!$this->_extendStatement) $exprops[]="\0$cn\0_extendStatement"; |
|
| 311 | + if(!$this->_cache) $exprops[]="\0$cn\0_cache"; |
|
| 312 | + |
|
| 313 | + return array_diff(parent::__sleep(), $exprops); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | } |
| 317 | 317 | \ No newline at end of file |
@@ -40,6 +40,7 @@ discard block |
||
| 40 | 40 | * @param int page size |
| 41 | 41 | * @param mixed delegate for each data row retrieved. |
| 42 | 42 | * @param int number of page to fetch on initialization |
| 43 | + * @param integer $pageSize |
|
| 43 | 44 | */ |
| 44 | 45 | public function __construct(IMappedStatement $statement,$parameter, $pageSize, $delegate=null, $page=0) |
| 45 | 46 | { |
@@ -55,6 +56,8 @@ discard block |
||
| 55 | 56 | * @param mixed query parameters |
| 56 | 57 | * @param int page size. |
| 57 | 58 | * @param int number of page. |
| 59 | + * @param IMappedStatement $statement |
|
| 60 | + * @param integer $page |
|
| 58 | 61 | */ |
| 59 | 62 | protected function initialize($statement, $parameter, $pageSize, $page) |
| 60 | 63 | { |
@@ -129,28 +129,24 @@ |
||
| 129 | 129 | { |
| 130 | 130 | $param->setData($data); |
| 131 | 131 | $this->_nextPageList = null; |
| 132 | - } |
|
| 133 | - else |
|
| 132 | + } else |
|
| 134 | 133 | { |
| 135 | 134 | $param->setData(array_slice($data, 0, $pageSize)); |
| 136 | 135 | $this->_nextPageList = array_slice($data, $pageSize-1,$total); |
| 137 | 136 | } |
| 138 | - } |
|
| 139 | - else |
|
| 137 | + } else |
|
| 140 | 138 | { |
| 141 | 139 | if($total <= $pageSize) |
| 142 | 140 | { |
| 143 | 141 | $this->_prevPageList = array_slice($data, 0, $total); |
| 144 | 142 | $param->setData(array()); |
| 145 | 143 | $this->_nextPageList = null; |
| 146 | - } |
|
| 147 | - else if($total <= $pageSize*2) |
|
| 144 | + } else if($total <= $pageSize*2) |
|
| 148 | 145 | { |
| 149 | 146 | $this->_prevPageList = array_slice($data, 0, $pageSize); |
| 150 | 147 | $param->setData(array_slice($data, $pageSize, $total)); |
| 151 | 148 | $this->_nextPageList = null; |
| 152 | - } |
|
| 153 | - else |
|
| 149 | + } else |
|
| 154 | 150 | { |
| 155 | 151 | $this->_prevPageList = array_slice($data, 0, $pageSize); |
| 156 | 152 | $param->setData(array_slice($data, $pageSize, $pageSize)); |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | * @param mixed delegate for each data row retrieved. |
| 42 | 42 | * @param int number of page to fetch on initialization |
| 43 | 43 | */ |
| 44 | - public function __construct(IMappedStatement $statement,$parameter, $pageSize, $delegate=null, $page=0) |
|
| 44 | + public function __construct(IMappedStatement $statement, $parameter, $pageSize, $delegate=null, $page=0) |
|
| 45 | 45 | { |
| 46 | 46 | parent::__construct(); |
| 47 | 47 | parent::setCustomPaging(true); |
| 48 | - $this->initialize($statement,$parameter, $pageSize, $page); |
|
| 48 | + $this->initialize($statement, $parameter, $pageSize, $page); |
|
| 49 | 49 | $this->_delegate=$delegate; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | protected function initialize($statement, $parameter, $pageSize, $page) |
| 60 | 60 | { |
| 61 | - $this->_statement = $statement; |
|
| 62 | - $this->_parameter = $parameter; |
|
| 61 | + $this->_statement=$statement; |
|
| 62 | + $this->_parameter=$parameter; |
|
| 63 | 63 | $this->setPageSize($pageSize); |
| 64 | 64 | $this->attachEventHandler('OnFetchData', array($this, 'fetchDataFromStatement')); |
| 65 | 65 | $this->gotoPage($page); |
@@ -80,9 +80,9 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | protected function fetchDataFromStatement($sender, $param) |
| 82 | 82 | { |
| 83 | - $limit = $this->getOffsetAndLimit($param); |
|
| 84 | - $connection = $this->_statement->getManager()->getDbConnection(); |
|
| 85 | - $data = $this->_statement->executeQueryForList($connection, |
|
| 83 | + $limit=$this->getOffsetAndLimit($param); |
|
| 84 | + $connection=$this->_statement->getManager()->getDbConnection(); |
|
| 85 | + $data=$this->_statement->executeQueryForList($connection, |
|
| 86 | 86 | $this->_parameter, null, $limit[0], $limit[1], $this->_delegate); |
| 87 | 87 | $this->populateData($param, $data); |
| 88 | 88 | } |
@@ -112,49 +112,49 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | protected function populateData($param, $data) |
| 114 | 114 | { |
| 115 | - $total = $data instanceof TList ? $data->getCount() : count($data); |
|
| 116 | - $pageSize = $this->getPageSize(); |
|
| 115 | + $total=$data instanceof TList ? $data->getCount() : count($data); |
|
| 116 | + $pageSize=$this->getPageSize(); |
|
| 117 | 117 | if($total < 1) |
| 118 | 118 | { |
| 119 | 119 | $param->setData($data); |
| 120 | - $this->_prevPageList = null; |
|
| 121 | - $this->_nextPageList = null; |
|
| 120 | + $this->_prevPageList=null; |
|
| 121 | + $this->_nextPageList=null; |
|
| 122 | 122 | return; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if($param->getNewPageIndex() < 1) |
| 126 | 126 | { |
| 127 | - $this->_prevPageList = null; |
|
| 127 | + $this->_prevPageList=null; |
|
| 128 | 128 | if($total <= $pageSize) |
| 129 | 129 | { |
| 130 | 130 | $param->setData($data); |
| 131 | - $this->_nextPageList = null; |
|
| 131 | + $this->_nextPageList=null; |
|
| 132 | 132 | } |
| 133 | 133 | else |
| 134 | 134 | { |
| 135 | 135 | $param->setData(array_slice($data, 0, $pageSize)); |
| 136 | - $this->_nextPageList = array_slice($data, $pageSize-1,$total); |
|
| 136 | + $this->_nextPageList=array_slice($data, $pageSize - 1, $total); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | else |
| 140 | 140 | { |
| 141 | 141 | if($total <= $pageSize) |
| 142 | 142 | { |
| 143 | - $this->_prevPageList = array_slice($data, 0, $total); |
|
| 143 | + $this->_prevPageList=array_slice($data, 0, $total); |
|
| 144 | 144 | $param->setData(array()); |
| 145 | - $this->_nextPageList = null; |
|
| 145 | + $this->_nextPageList=null; |
|
| 146 | 146 | } |
| 147 | - else if($total <= $pageSize*2) |
|
| 147 | + else if($total <= $pageSize * 2) |
|
| 148 | 148 | { |
| 149 | - $this->_prevPageList = array_slice($data, 0, $pageSize); |
|
| 149 | + $this->_prevPageList=array_slice($data, 0, $pageSize); |
|
| 150 | 150 | $param->setData(array_slice($data, $pageSize, $total)); |
| 151 | - $this->_nextPageList = null; |
|
| 151 | + $this->_nextPageList=null; |
|
| 152 | 152 | } |
| 153 | 153 | else |
| 154 | 154 | { |
| 155 | - $this->_prevPageList = array_slice($data, 0, $pageSize); |
|
| 155 | + $this->_prevPageList=array_slice($data, 0, $pageSize); |
|
| 156 | 156 | $param->setData(array_slice($data, $pageSize, $pageSize)); |
| 157 | - $this->_nextPageList = array_slice($data, $pageSize*2, $total-$pageSize*2); |
|
| 157 | + $this->_nextPageList=array_slice($data, $pageSize * 2, $total - $pageSize * 2); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -166,9 +166,9 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | protected function getOffsetAndLimit($param) |
| 168 | 168 | { |
| 169 | - $index = $param->getNewPageIndex(); |
|
| 170 | - $pageSize = $this->getPageSize(); |
|
| 171 | - return $index < 1 ? array($index, $pageSize*2) : array(($index-1)*$pageSize, $pageSize*3); |
|
| 169 | + $index=$param->getNewPageIndex(); |
|
| 170 | + $pageSize=$this->getPageSize(); |
|
| 171 | + return $index < 1 ? array($index, $pageSize * 2) : array(($index - 1) * $pageSize, $pageSize * 3); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -97,6 +97,10 @@ |
||
| 97 | 97 | return $cacheKey->getHash(); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | + /** |
|
| 101 | + * @param integer $skip |
|
| 102 | + * @param integer $max |
|
| 103 | + */ |
|
| 100 | 104 | protected function createCommand($connection, $parameter, $skip=null, $max=null) |
| 101 | 105 | { |
| 102 | 106 | return $this->_mappedStatement->getCommand()->create($this->getManager(), |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public function __construct(TMappedStatement $statement) |
| 24 | 24 | { |
| 25 | - $this->_mappedStatement = $statement; |
|
| 25 | + $this->_mappedStatement=$statement; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public function getID() |
@@ -40,15 +40,15 @@ discard block |
||
| 40 | 40 | return $this->_mappedStatement->getManager(); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function executeQueryForMap($connection, $parameter,$keyProperty, $valueProperty=null, $skip=-1, $max=-1,$delegate=null) |
|
| 43 | + public function executeQueryForMap($connection, $parameter, $keyProperty, $valueProperty=null, $skip=-1, $max=-1, $delegate=null) |
|
| 44 | 44 | { |
| 45 | - $sql = $this->createCommand($connection, $parameter, $skip, $max); |
|
| 46 | - $key = $this->getCacheKey(array(clone($sql), $keyProperty, $valueProperty,$skip, $max)); |
|
| 47 | - $map = $this->getStatement()->getCache()->get($key); |
|
| 45 | + $sql=$this->createCommand($connection, $parameter, $skip, $max); |
|
| 46 | + $key=$this->getCacheKey(array(clone($sql), $keyProperty, $valueProperty, $skip, $max)); |
|
| 47 | + $map=$this->getStatement()->getCache()->get($key); |
|
| 48 | 48 | if($map===null) |
| 49 | 49 | { |
| 50 | - $map = $this->_mappedStatement->runQueryForMap( |
|
| 51 | - $connection, $parameter, $sql, $keyProperty, $valueProperty, $delegate); |
|
| 50 | + $map=$this->_mappedStatement->runQueryForMap( |
|
| 51 | + $connection, $parameter, $sql, $keyProperty, $valueProperty, $delegate); |
|
| 52 | 52 | $this->getStatement()->getCache()->set($key, $map); |
| 53 | 53 | } |
| 54 | 54 | return $map; |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | public function executeQueryForList($connection, $parameter, $result=null, $skip=-1, $max=-1, $delegate=null) |
| 68 | 68 | { |
| 69 | - $sql = $this->createCommand($connection, $parameter, $skip, $max); |
|
| 70 | - $key = $this->getCacheKey(array(clone($sql), $parameter, $skip, $max)); |
|
| 71 | - $list = $this->getStatement()->getCache()->get($key); |
|
| 69 | + $sql=$this->createCommand($connection, $parameter, $skip, $max); |
|
| 70 | + $key=$this->getCacheKey(array(clone($sql), $parameter, $skip, $max)); |
|
| 71 | + $list=$this->getStatement()->getCache()->get($key); |
|
| 72 | 72 | if($list===null) |
| 73 | 73 | { |
| 74 | - $list = $this->_mappedStatement->runQueryForList( |
|
| 74 | + $list=$this->_mappedStatement->runQueryForList( |
|
| 75 | 75 | $connection, $parameter, $sql, $result, $delegate); |
| 76 | 76 | $this->getStatement()->getCache()->set($key, $list); |
| 77 | 77 | } |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | public function executeQueryForObject($connection, $parameter, $result=null) |
| 82 | 82 | { |
| 83 | - $sql = $this->createCommand($connection, $parameter); |
|
| 84 | - $key = $this->getCacheKey(array(clone($sql), $parameter)); |
|
| 85 | - $object = $this->getStatement()->getCache()->get($key); |
|
| 83 | + $sql=$this->createCommand($connection, $parameter); |
|
| 84 | + $key=$this->getCacheKey(array(clone($sql), $parameter)); |
|
| 85 | + $object=$this->getStatement()->getCache()->get($key); |
|
| 86 | 86 | if($object===null) |
| 87 | 87 | { |
| 88 | - $object = $this->_mappedStatement->runQueryForObject($connection, $sql, $result); |
|
| 88 | + $object=$this->_mappedStatement->runQueryForObject($connection, $sql, $result); |
|
| 89 | 89 | $this->getStatement()->getCache()->set($key, $object); |
| 90 | 90 | } |
| 91 | 91 | return $object; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | protected function getCacheKey($object) |
| 95 | 95 | { |
| 96 | - $cacheKey = new TSqlMapCacheKey($object); |
|
| 96 | + $cacheKey=new TSqlMapCacheKey($object); |
|
| 97 | 97 | return $cacheKey->getHash(); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -77,6 +77,7 @@ |
||
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * Saves the current SqlMap manager to cache. |
| 80 | + * @param TSqlMapManager $manager |
|
| 80 | 81 | * @return boolean true if SqlMap manager was cached, false otherwise. |
| 81 | 82 | */ |
| 82 | 83 | protected function cacheSqlMapManager($manager) |
@@ -68,8 +68,7 @@ |
||
| 68 | 68 | $manager->configureXml($file); |
| 69 | 69 | $this->cacheSqlMapManager($manager); |
| 70 | 70 | } |
| 71 | - } |
|
| 72 | - elseif($this->getConnectionID() !== '') { |
|
| 71 | + } elseif($this->getConnectionID() !== '') { |
|
| 73 | 72 | $manager->setDbConnection($this->getDbConnection()); |
| 74 | 73 | } |
| 75 | 74 | return $manager; |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function clearCache() |
| 46 | 46 | { |
| 47 | - $cache = $this->getApplication()->getCache(); |
|
| 48 | - if($cache !== null) { |
|
| 47 | + $cache=$this->getApplication()->getCache(); |
|
| 48 | + if($cache!==null) { |
|
| 49 | 49 | $cache->delete($this->getCacheKey()); |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -60,16 +60,16 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function getSqlMapManager() { |
| 62 | 62 | Prado::using('System.Data.SqlMap.TSqlMapManager'); |
| 63 | - if(($manager = $this->loadCachedSqlMapManager())===null) |
|
| 63 | + if(($manager=$this->loadCachedSqlMapManager())===null) |
|
| 64 | 64 | { |
| 65 | - $manager = new TSqlMapManager($this->getDbConnection()); |
|
| 65 | + $manager=new TSqlMapManager($this->getDbConnection()); |
|
| 66 | 66 | if(strlen($file=$this->getConfigFile()) > 0) |
| 67 | 67 | { |
| 68 | 68 | $manager->configureXml($file); |
| 69 | 69 | $this->cacheSqlMapManager($manager); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | - elseif($this->getConnectionID() !== '') { |
|
| 72 | + elseif($this->getConnectionID()!=='') { |
|
| 73 | 73 | $manager->setDbConnection($this->getDbConnection()); |
| 74 | 74 | } |
| 75 | 75 | return $manager; |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | if($this->getEnableCache()) |
| 85 | 85 | { |
| 86 | - $cache = $this->getApplication()->getCache(); |
|
| 87 | - if($cache !== null) { |
|
| 88 | - $dependencies = null; |
|
| 89 | - if($this->getApplication()->getMode() !== TApplicationMode::Performance) |
|
| 90 | - $dependencies = $manager->getCacheDependencies(); |
|
| 86 | + $cache=$this->getApplication()->getCache(); |
|
| 87 | + if($cache!==null) { |
|
| 88 | + $dependencies=null; |
|
| 89 | + if($this->getApplication()->getMode()!==TApplicationMode::Performance) |
|
| 90 | + $dependencies=$manager->getCacheDependencies(); |
|
| 91 | 91 | return $cache->set($this->getCacheKey(), $manager, 0, $dependencies); |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -102,10 +102,10 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | if($this->getEnableCache()) |
| 104 | 104 | { |
| 105 | - $cache = $this->getApplication()->getCache(); |
|
| 106 | - if($cache !== null) |
|
| 105 | + $cache=$this->getApplication()->getCache(); |
|
| 106 | + if($cache!==null) |
|
| 107 | 107 | { |
| 108 | - $manager = $cache->get($this->getCacheKey()); |
|
| 108 | + $manager=$cache->get($this->getCacheKey()); |
|
| 109 | 109 | if($manager instanceof TSqlMapManager) |
| 110 | 110 | return $manager; |
| 111 | 111 | } |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | $this->_configFile=$value; |
| 133 | 133 | else |
| 134 | 134 | { |
| 135 | - $file = Prado::getPathOfNamespace($value,self::CONFIG_FILE_EXT); |
|
| 136 | - if($file === null || !is_file($file)) |
|
| 137 | - throw new TConfigurationException('sqlmap_configfile_invalid',$value); |
|
| 135 | + $file=Prado::getPathOfNamespace($value, self::CONFIG_FILE_EXT); |
|
| 136 | + if($file===null || !is_file($file)) |
|
| 137 | + throw new TConfigurationException('sqlmap_configfile_invalid', $value); |
|
| 138 | 138 | else |
| 139 | - $this->_configFile = $file; |
|
| 139 | + $this->_configFile=$file; |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public function setEnableCache($value) |
| 148 | 148 | { |
| 149 | - $this->_enableCache = TPropertyValue::ensureBoolean($value); |
|
| 149 | + $this->_enableCache=TPropertyValue::ensureBoolean($value); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public function getClient() |
| 173 | 173 | { |
| 174 | - if($this->_sqlmap===null ) |
|
| 174 | + if($this->_sqlmap===null) |
|
| 175 | 175 | $this->_sqlmap=$this->createSqlMapGateway(); |
| 176 | 176 | return $this->_sqlmap; |
| 177 | 177 | } |
@@ -149,6 +149,7 @@ |
||
| 149 | 149 | /** |
| 150 | 150 | * Finds the database connection instance from the Application modules. |
| 151 | 151 | * @param string Database connection module ID. |
| 152 | + * @param string $id |
|
| 152 | 153 | * @return TDbConnection database connection. |
| 153 | 154 | * @throws TConfigurationException when module is not of TDbConnection or TDataSourceConfig. |
| 154 | 155 | */ |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | $db=$this->getDbConnection(); |
| 64 | 64 | foreach($xml['database'] as $name=>$value) |
| 65 | - $db->setSubProperty($name,$value); |
|
| 65 | + $db->setSubProperty($name, $value); |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | else |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | $db=$this->getDbConnection(); |
| 73 | 73 | foreach($prop->getAttributes() as $name=>$value) |
| 74 | - $db->setSubproperty($name,$value); |
|
| 74 | + $db->setSubproperty($name, $value); |
|
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | } |
@@ -106,9 +106,9 @@ discard block |
||
| 106 | 106 | if($this->_conn===null) |
| 107 | 107 | { |
| 108 | 108 | if($this->_connID!=='') |
| 109 | - $this->_conn = $this->findConnectionByID($this->getConnectionID()); |
|
| 109 | + $this->_conn=$this->findConnectionByID($this->getConnectionID()); |
|
| 110 | 110 | else |
| 111 | - $this->_conn = Prado::createComponent($this->getConnectionClass()); |
|
| 111 | + $this->_conn=Prado::createComponent($this->getConnectionClass()); |
|
| 112 | 112 | } |
| 113 | 113 | return $this->_conn; |
| 114 | 114 | } |
@@ -154,12 +154,12 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | protected function findConnectionByID($id) |
| 156 | 156 | { |
| 157 | - $conn = $this->getApplication()->getModule($id); |
|
| 157 | + $conn=$this->getApplication()->getModule($id); |
|
| 158 | 158 | if($conn instanceof TDbConnection) |
| 159 | 159 | return $conn; |
| 160 | 160 | else if($conn instanceof TDataSourceConfig) |
| 161 | 161 | return $conn->getDbConnection(); |
| 162 | 162 | else |
| 163 | - throw new TConfigurationException('datasource_dbconnection_invalid',$id); |
|
| 163 | + throw new TConfigurationException('datasource_dbconnection_invalid', $id); |
|
| 164 | 164 | } |
| 165 | 165 | } |
@@ -58,8 +58,7 @@ |
||
| 58 | 58 | if ($this->sourcepath === NULL) |
| 59 | 59 | { |
| 60 | 60 | $this->sourcepath = $sourcepath; |
| 61 | - } |
|
| 62 | - else |
|
| 61 | + } else |
|
| 63 | 62 | { |
| 64 | 63 | $this->sourcepath->append($sourcepath); |
| 65 | 64 | } |
@@ -157,6 +157,7 @@ discard block |
||
| 157 | 157 | /** |
| 158 | 158 | * Open or close the DB connection. |
| 159 | 159 | * @param boolean whether to open or close DB connection |
| 160 | + * @param boolean $value |
|
| 160 | 161 | * @throws TDbException if connection fails |
| 161 | 162 | */ |
| 162 | 163 | public function setActive($value) |
@@ -241,6 +242,7 @@ discard block |
||
| 241 | 242 | |
| 242 | 243 | /** |
| 243 | 244 | * @param string The Data Source Name, or DSN, contains the information required to connect to the database. |
| 245 | + * @param string $value |
|
| 244 | 246 | * @see http://www.php.net/manual/en/function.PDO-construct.php |
| 245 | 247 | */ |
| 246 | 248 | public function setConnectionString($value) |
@@ -258,6 +260,7 @@ discard block |
||
| 258 | 260 | |
| 259 | 261 | /** |
| 260 | 262 | * @param string the username for establishing DB connection |
| 263 | + * @param string $value |
|
| 261 | 264 | */ |
| 262 | 265 | public function setUsername($value) |
| 263 | 266 | { |
@@ -274,6 +277,7 @@ discard block |
||
| 274 | 277 | |
| 275 | 278 | /** |
| 276 | 279 | * @param string the password for establishing DB connection |
| 280 | + * @param string $value |
|
| 277 | 281 | */ |
| 278 | 282 | public function setPassword($value) |
| 279 | 283 | { |
@@ -189,8 +189,7 @@ discard block |
||
| 189 | 189 | $this->_pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 190 | 190 | $this->_active=true; |
| 191 | 191 | $this->setConnectionCharset(); |
| 192 | - } |
|
| 193 | - catch(PDOException $e) |
|
| 192 | + } catch(PDOException $e) |
|
| 194 | 193 | { |
| 195 | 194 | throw new TDbException('dbconnection_open_failed',$e->getMessage()); |
| 196 | 195 | } |
@@ -343,8 +342,7 @@ discard block |
||
| 343 | 342 | { |
| 344 | 343 | $this->_pdo->beginTransaction(); |
| 345 | 344 | return $this->_transaction=Prado::createComponent($this->getTransactionClass(), $this); |
| 346 | - } |
|
| 347 | - else |
|
| 345 | + } else |
|
| 348 | 346 | throw new TDbException('dbconnection_connection_inactive'); |
| 349 | 347 | } |
| 350 | 348 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * @since 3.1.7 |
| 94 | 94 | */ |
| 95 | - const DEFAULT_TRANSACTION_CLASS = 'System.Data.TDbTransaction'; |
|
| 95 | + const DEFAULT_TRANSACTION_CLASS='System.Data.TDbTransaction'; |
|
| 96 | 96 | |
| 97 | 97 | private $_dsn=''; |
| 98 | 98 | private $_username=''; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | /** |
| 107 | 107 | * @var TDbMetaData |
| 108 | 108 | */ |
| 109 | - private $_dbMeta = null; |
|
| 109 | + private $_dbMeta=null; |
|
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | 112 | * @var string |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @param string Charset used for DB Connection (MySql & pgsql only). If not set, will use the default charset of your database server |
| 128 | 128 | * @see http://www.php.net/manual/en/function.PDO-construct.php |
| 129 | 129 | */ |
| 130 | - public function __construct($dsn='',$username='',$password='', $charset='') |
|
| 130 | + public function __construct($dsn='', $username='', $password='', $charset='') |
|
| 131 | 131 | { |
| 132 | 132 | $this->_dsn=$dsn; |
| 133 | 133 | $this->_username=$username; |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | public function __sleep() |
| 142 | 142 | { |
| 143 | 143 | // $this->close(); - DO NOT CLOSE the current connection as serializing doesn't neccessarily mean we don't this connection anymore in the current session |
| 144 | - return array_diff(parent::__sleep(),array("\0Prado\Data\TDbConnection\0_pdo","\0Prado\Data\TDbConnection\0_active")); |
|
| 144 | + return array_diff(parent::__sleep(), array("\0Prado\Data\TDbConnection\0_pdo", "\0Prado\Data\TDbConnection\0_active")); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -188,8 +188,8 @@ discard block |
||
| 188 | 188 | { |
| 189 | 189 | try |
| 190 | 190 | { |
| 191 | - $this->_pdo=new PDO($this->getConnectionString(),$this->getUsername(), |
|
| 192 | - $this->getPassword(),$this->_attributes); |
|
| 191 | + $this->_pdo=new PDO($this->getConnectionString(), $this->getUsername(), |
|
| 192 | + $this->getPassword(), $this->_attributes); |
|
| 193 | 193 | // This attribute is only useful for PDO::MySql driver. |
| 194 | 194 | // Ignore the warning if a driver doesn't understand this. |
| 195 | 195 | @$this->_pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | catch(PDOException $e) |
| 201 | 201 | { |
| 202 | - throw new TDbException('dbconnection_open_failed',$e->getMessage()); |
|
| 202 | + throw new TDbException('dbconnection_open_failed', $e->getMessage()); |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | } |
@@ -221,16 +221,16 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | protected function setConnectionCharset() |
| 223 | 223 | { |
| 224 | - if ($this->_charset === '' || $this->_active === false) |
|
| 224 | + if($this->_charset==='' || $this->_active===false) |
|
| 225 | 225 | return; |
| 226 | - switch ($this->_pdo->getAttribute(PDO::ATTR_DRIVER_NAME)) |
|
| 226 | + switch($this->_pdo->getAttribute(PDO::ATTR_DRIVER_NAME)) |
|
| 227 | 227 | { |
| 228 | 228 | case 'mysql': |
| 229 | 229 | case 'sqlite': |
| 230 | - $stmt = $this->_pdo->prepare('SET NAMES ?'); |
|
| 230 | + $stmt=$this->_pdo->prepare('SET NAMES ?'); |
|
| 231 | 231 | break; |
| 232 | 232 | case 'pgsql': |
| 233 | - $stmt = $this->_pdo->prepare('SET client_encoding TO ?'); |
|
| 233 | + $stmt=$this->_pdo->prepare('SET client_encoding TO ?'); |
|
| 234 | 234 | break; |
| 235 | 235 | default: |
| 236 | 236 | throw new TDbException('dbconnection_unsupported_driver_charset', $driver); |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | /** |
| 291 | 291 | * @return string the charset used for database connection. Defaults to emtpy string. |
| 292 | 292 | */ |
| 293 | - public function getCharset () |
|
| 293 | + public function getCharset() |
|
| 294 | 294 | { |
| 295 | 295 | return $this->_charset; |
| 296 | 296 | } |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | /** |
| 299 | 299 | * @param string the charset used for database connection |
| 300 | 300 | */ |
| 301 | - public function setCharset ($value) |
|
| 301 | + public function setCharset($value) |
|
| 302 | 302 | { |
| 303 | 303 | $this->_charset=$value; |
| 304 | 304 | $this->setConnectionCharset(); |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | public function createCommand($sql) |
| 322 | 322 | { |
| 323 | 323 | if($this->getActive()) |
| 324 | - return new TDbCommand($this,$sql); |
|
| 324 | + return new TDbCommand($this, $sql); |
|
| 325 | 325 | else |
| 326 | 326 | throw new TDbException('dbconnection_connection_inactive'); |
| 327 | 327 | } |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | */ |
| 372 | 372 | public function setTransactionClass($value) |
| 373 | 373 | { |
| 374 | - $this->_transactionClass = (string)$value; |
|
| 374 | + $this->_transactionClass=(string) $value; |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | /** |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | { |
| 440 | 440 | if($this->_dbMeta===null) |
| 441 | 441 | { |
| 442 | - $this->_dbMeta = TDbMetaData::getInstance($this); |
|
| 442 | + $this->_dbMeta=TDbMetaData::getInstance($this); |
|
| 443 | 443 | } |
| 444 | 444 | return $this->_dbMeta; |
| 445 | 445 | } |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | */ |
| 466 | 466 | public function setColumnCase($value) |
| 467 | 467 | { |
| 468 | - switch(TPropertyValue::ensureEnum($value,'Prado\\Data\\TDbColumnCaseMode')) |
|
| 468 | + switch(TPropertyValue::ensureEnum($value, 'Prado\\Data\\TDbColumnCaseMode')) |
|
| 469 | 469 | { |
| 470 | 470 | case TDbColumnCaseMode::Preserved: |
| 471 | 471 | $value=PDO::CASE_NATURAL; |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | $value=PDO::CASE_UPPER; |
| 478 | 478 | break; |
| 479 | 479 | } |
| 480 | - $this->setAttribute(PDO::ATTR_CASE,$value); |
|
| 480 | + $this->setAttribute(PDO::ATTR_CASE, $value); |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | /** |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | */ |
| 502 | 502 | public function setNullConversion($value) |
| 503 | 503 | { |
| 504 | - switch(TPropertyValue::ensureEnum($value,'Prado\\Data\\TDbNullConversionMode')) |
|
| 504 | + switch(TPropertyValue::ensureEnum($value, 'Prado\\Data\\TDbNullConversionMode')) |
|
| 505 | 505 | { |
| 506 | 506 | case TDbNullConversionMode::Preserved: |
| 507 | 507 | $value=PDO::NULL_NATURAL; |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | $value=PDO::NULL_TO_STRING; |
| 514 | 514 | break; |
| 515 | 515 | } |
| 516 | - $this->setAttribute(PDO::ATTR_ORACLE_NULLS,$value); |
|
| 516 | + $this->setAttribute(PDO::ATTR_ORACLE_NULLS, $value); |
|
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | /** |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | */ |
| 532 | 532 | public function setAutoCommit($value) |
| 533 | 533 | { |
| 534 | - $this->setAttribute(PDO::ATTR_AUTOCOMMIT,TPropertyValue::ensureBoolean($value)); |
|
| 534 | + $this->setAttribute(PDO::ATTR_AUTOCOMMIT, TPropertyValue::ensureBoolean($value)); |
|
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | /** |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | */ |
| 550 | 550 | public function setPersistent($value) |
| 551 | 551 | { |
| 552 | - return $this->setAttribute(PDO::ATTR_PERSISTENT,TPropertyValue::ensureBoolean($value)); |
|
| 552 | + return $this->setAttribute(PDO::ATTR_PERSISTENT, TPropertyValue::ensureBoolean($value)); |
|
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | /** |
@@ -629,10 +629,10 @@ discard block |
||
| 629 | 629 | * @param mixed the attribute value |
| 630 | 630 | * @see http://www.php.net/manual/en/function.PDO-setAttribute.php |
| 631 | 631 | */ |
| 632 | - public function setAttribute($name,$value) |
|
| 632 | + public function setAttribute($name, $value) |
|
| 633 | 633 | { |
| 634 | 634 | if($this->_pdo instanceof PDO) |
| 635 | - $this->_pdo->setAttribute($name,$value); |
|
| 635 | + $this->_pdo->setAttribute($name, $value); |
|
| 636 | 636 | else |
| 637 | 637 | $this->_attributes[$name]=$value; |
| 638 | 638 | } |
@@ -101,6 +101,7 @@ |
||
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * @param boolean whether this transaction is active |
| 104 | + * @param boolean $value |
|
| 104 | 105 | */ |
| 105 | 106 | protected function setActive($value) |
| 106 | 107 | { |
@@ -189,8 +189,7 @@ discard block |
||
| 189 | 189 | return file_put_contents($fileName,file_get_contents($this->_localName))!==false; |
| 190 | 190 | else |
| 191 | 191 | return false; |
| 192 | - } |
|
| 193 | - else |
|
| 192 | + } else |
|
| 194 | 193 | return false; |
| 195 | 194 | } |
| 196 | 195 | |
@@ -211,8 +210,7 @@ discard block |
||
| 211 | 210 | $this->_errorCode=$_FILES[$key]['error']; |
| 212 | 211 | $this->_localName=$_FILES[$key]['tmp_name']; |
| 213 | 212 | return $this->_dataChanged=true; |
| 214 | - } |
|
| 215 | - else |
|
| 213 | + } else |
|
| 216 | 214 | return false; |
| 217 | 215 | } |
| 218 | 216 | |