@@ -132,6 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | /** |
| 134 | 134 | * @param TSubMap add new sub mapping. |
| 135 | + * @param TSubMap $subMap |
|
| 135 | 136 | */ |
| 136 | 137 | public function addSubMap($subMap) |
| 137 | 138 | { |
@@ -140,6 +141,7 @@ discard block |
||
| 140 | 141 | |
| 141 | 142 | /** |
| 142 | 143 | * @param string database value |
| 144 | + * @param string $value |
|
| 143 | 145 | * @return TResultMap result mapping. |
| 144 | 146 | */ |
| 145 | 147 | public function getSubMap($value) |
@@ -151,6 +153,7 @@ discard block |
||
| 151 | 153 | /** |
| 152 | 154 | * Copies the discriminator properties to a new TResultProperty. |
| 153 | 155 | * @param TResultMap result map holding the discriminator. |
| 156 | + * @param TResultMap $resultMap |
|
| 154 | 157 | */ |
| 155 | 158 | public function initMapping($resultMap) |
| 156 | 159 | { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function setColumn($value) |
| 54 | 54 | { |
| 55 | - $this->_column = $value; |
|
| 55 | + $this->_column=$value; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function setType($value) |
| 74 | 74 | { |
| 75 | - $this->_type = $value; |
|
| 75 | + $this->_type=$value; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function setTypeHandler($value) |
| 90 | 90 | { |
| 91 | - $this->_typeHandler = $value; |
|
| 91 | + $this->_typeHandler=$value; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function setColumnIndex($value) |
| 108 | 108 | { |
| 109 | - $this->_columnIndex = TPropertyValue::ensureInteger($value); |
|
| 109 | + $this->_columnIndex=TPropertyValue::ensureInteger($value); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function setNullValue($value) |
| 124 | 124 | { |
| 125 | - $this->_nullValue = $value; |
|
| 125 | + $this->_nullValue=$value; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public function addSubMap($subMap) |
| 140 | 140 | { |
| 141 | - $this->_subMaps[] = $subMap; |
|
| 141 | + $this->_subMaps[]=$subMap; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function initMapping($resultMap) |
| 159 | 159 | { |
| 160 | - $this->_mapping = new TResultProperty($resultMap); |
|
| 160 | + $this->_mapping=new TResultProperty($resultMap); |
|
| 161 | 161 | $this->_mapping->setColumn($this->getColumn()); |
| 162 | 162 | $this->_mapping->setColumnIndex($this->getColumnIndex()); |
| 163 | 163 | $this->_mapping->setType($this->getType()); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | { |
| 174 | 174 | foreach($this->_subMaps as $subMap) |
| 175 | 175 | { |
| 176 | - $this->_resultMaps[$subMap->getValue()] = |
|
| 176 | + $this->_resultMaps[$subMap->getValue()]= |
|
| 177 | 177 | $manager->getResultMap($subMap->getResultMapping()); |
| 178 | 178 | } |
| 179 | 179 | } |
@@ -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 | } |
@@ -110,6 +110,7 @@ |
||
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | 112 | * @param string name of a property of the parameter object. |
| 113 | + * @param string $value |
|
| 113 | 114 | */ |
| 114 | 115 | public function setProperty($value) |
| 115 | 116 | { |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function setTypeHandler($value) |
| 51 | 51 | { |
| 52 | - $this->_typeHandler = $value; |
|
| 52 | + $this->_typeHandler=$value; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function setType($value) |
| 67 | 67 | { |
| 68 | - $this->_type = $value; |
|
| 68 | + $this->_type=$value; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function setColumn($value) |
| 83 | 83 | { |
| 84 | - $this->_column = $value; |
|
| 84 | + $this->_column=$value; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function setDbType($value) |
| 99 | 99 | { |
| 100 | - $this->_dbType = $value; |
|
| 100 | + $this->_dbType=$value; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function setProperty($value) |
| 115 | 115 | { |
| 116 | - $this->_property = $value; |
|
| 116 | + $this->_property=$value; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -130,19 +130,19 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public function setNullValue($value) |
| 132 | 132 | { |
| 133 | - $this->_nullValue = $value; |
|
| 133 | + $this->_nullValue=$value; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | public function __sleep() |
| 137 | 137 | { |
| 138 | - $exprops = array(); $cn = 'TParameterProperty'; |
|
| 139 | - if ($this->_typeHandler===null) $exprops[] = "\0$cn\0_typeHandler"; |
|
| 140 | - if ($this->_type===null) $exprops[] = "\0$cn\0_type"; |
|
| 141 | - if ($this->_column===null) $exprops[] = "\0$cn\0_column"; |
|
| 142 | - if ($this->_dbType===null) $exprops[] = "\0$cn\0_dbType"; |
|
| 143 | - if ($this->_property===null) $exprops[] = "\0$cn\0_property"; |
|
| 144 | - if ($this->_nullValue===null) $exprops[] = "\0$cn\0_nullValue"; |
|
| 145 | - return array_diff(parent::__sleep(),$exprops); |
|
| 138 | + $exprops=array(); $cn='TParameterProperty'; |
|
| 139 | + if($this->_typeHandler===null) $exprops[]="\0$cn\0_typeHandler"; |
|
| 140 | + if($this->_type===null) $exprops[]="\0$cn\0_type"; |
|
| 141 | + if($this->_column===null) $exprops[]="\0$cn\0_column"; |
|
| 142 | + if($this->_dbType===null) $exprops[]="\0$cn\0_dbType"; |
|
| 143 | + if($this->_property===null) $exprops[]="\0$cn\0_property"; |
|
| 144 | + if($this->_nullValue===null) $exprops[]="\0$cn\0_nullValue"; |
|
| 145 | + return array_diff(parent::__sleep(), $exprops); |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
@@ -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 | { |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | private $_hostResultMapID='inplicit internal mapping'; |
| 55 | 55 | |
| 56 | - const LIST_TYPE = 0; |
|
| 57 | - const ARRAY_TYPE = 1; |
|
| 56 | + const LIST_TYPE=0; |
|
| 57 | + const ARRAY_TYPE=1; |
|
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * Gets the containing result map ID. |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | public function __construct($resultMap=null) |
| 64 | 64 | { |
| 65 | 65 | if($resultMap instanceof TResultMap) |
| 66 | - $this->_hostResultMapID = $resultMap->getID(); |
|
| 66 | + $this->_hostResultMapID=$resultMap->getID(); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function setNullValue($value) |
| 81 | 81 | { |
| 82 | - $this->_nullValue = $value; |
|
| 82 | + $this->_nullValue=$value; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function setProperty($value) |
| 97 | 97 | { |
| 98 | - $this->_propertyName = $value; |
|
| 98 | + $this->_propertyName=$value; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function setColumn($value) |
| 115 | 115 | { |
| 116 | - $this->_columnName = $value; |
|
| 116 | + $this->_columnName=$value; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function setColumnIndex($value) |
| 133 | 133 | { |
| 134 | - $this->_columnIndex = TPropertyValue::ensureInteger($value); |
|
| 134 | + $this->_columnIndex=TPropertyValue::ensureInteger($value); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public function setResultMapping($value) |
| 149 | 149 | { |
| 150 | - $this->_nestedResultMapName = $value; |
|
| 150 | + $this->_nestedResultMapName=$value; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | public function setNestedResultMap($value) |
| 165 | 165 | { |
| 166 | - $this->_nestedResultMap = $value; |
|
| 166 | + $this->_nestedResultMap=$value; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | public function setType($value) |
| 181 | 181 | { |
| 182 | - $this->_valueType = $value; |
|
| 182 | + $this->_valueType=$value; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | public function setTypeHandler($value) |
| 197 | 197 | { |
| 198 | - $this->_typeHandler = $value; |
|
| 198 | + $this->_typeHandler=$value; |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public function setSelect($value) |
| 215 | 215 | { |
| 216 | - $this->_select = $value; |
|
| 216 | + $this->_select=$value; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | /** |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | public function setLazyLoad($value) |
| 231 | 231 | { |
| 232 | - $this->_isLazyLoad = TPropertyValue::ensureBoolean($value,false); |
|
| 232 | + $this->_isLazyLoad=TPropertyValue::ensureBoolean($value, false); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | /** |
@@ -238,17 +238,17 @@ discard block |
||
| 238 | 238 | * @param array result row |
| 239 | 239 | * @return mixed property value. |
| 240 | 240 | */ |
| 241 | - public function getPropertyValue($registry,$row) |
|
| 241 | + public function getPropertyValue($registry, $row) |
|
| 242 | 242 | { |
| 243 | - $value = null; |
|
| 244 | - $index = $this->getColumnIndex(); |
|
| 245 | - $name = $this->getColumn(); |
|
| 243 | + $value=null; |
|
| 244 | + $index=$this->getColumnIndex(); |
|
| 245 | + $name=$this->getColumn(); |
|
| 246 | 246 | if($index > 0 && isset($row[$index])) |
| 247 | - $value = $this->getTypedValue($registry,$row[$index]); |
|
| 247 | + $value=$this->getTypedValue($registry, $row[$index]); |
|
| 248 | 248 | else if(isset($row[$name])) |
| 249 | - $value = $this->getTypedValue($registry,$row[$name]); |
|
| 249 | + $value=$this->getTypedValue($registry, $row[$name]); |
|
| 250 | 250 | if(($value===null) && ($this->getNullValue()!==null)) |
| 251 | - $value = $this->getTypedValue($registry,$this->getNullValue()); |
|
| 251 | + $value=$this->getTypedValue($registry, $this->getNullValue()); |
|
| 252 | 252 | return $value; |
| 253 | 253 | } |
| 254 | 254 | |
@@ -257,9 +257,9 @@ discard block |
||
| 257 | 257 | * @param mixed raw property value |
| 258 | 258 | * @return mixed property value casted to specific type. |
| 259 | 259 | */ |
| 260 | - protected function getTypedValue($registry,$value) |
|
| 260 | + protected function getTypedValue($registry, $value) |
|
| 261 | 261 | { |
| 262 | - if(($handler = $this->createTypeHandler($registry))!==null) |
|
| 262 | + if(($handler=$this->createTypeHandler($registry))!==null) |
|
| 263 | 263 | return $handler->getResult($value); |
| 264 | 264 | else |
| 265 | 265 | return $registry->convertToType($this->getType(), $value); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | $type=$this->getTypeHandler() ? $this->getTypeHandler() : $this->getType(); |
| 276 | 276 | $handler=$registry->getTypeHandler($type); |
| 277 | 277 | if($handler===null && $this->getTypeHandler()) |
| 278 | - $handler = Prado::createComponent($type); |
|
| 278 | + $handler=Prado::createComponent($type); |
|
| 279 | 279 | return $handler; |
| 280 | 280 | } |
| 281 | 281 | |
@@ -285,17 +285,17 @@ discard block |
||
| 285 | 285 | */ |
| 286 | 286 | protected function getPropertyValueType() |
| 287 | 287 | { |
| 288 | - if(class_exists($type = $this->getType(), false)) //NO force autoloading |
|
| 288 | + if(class_exists($type=$this->getType(), false)) //NO force autoloading |
|
| 289 | 289 | { |
| 290 | 290 | if($type==='TList') |
| 291 | 291 | return self::LIST_TYPE; |
| 292 | - $class = new ReflectionClass($type); |
|
| 292 | + $class=new ReflectionClass($type); |
|
| 293 | 293 | if($class->isSubclassOf('TList')) |
| 294 | 294 | return self::LIST_TYPE; |
| 295 | 295 | if($class->implementsInterface('ArrayAccess')) |
| 296 | 296 | return self::ARRAY_TYPE; |
| 297 | 297 | } |
| 298 | - if(strtolower($type) == 'array') |
|
| 298 | + if(strtolower($type)=='array') |
|
| 299 | 299 | return self::ARRAY_TYPE; |
| 300 | 300 | } |
| 301 | 301 | |
@@ -308,8 +308,8 @@ discard block |
||
| 308 | 308 | public function instanceOfListType($target) |
| 309 | 309 | { |
| 310 | 310 | if($this->getType()===null) |
| 311 | - return TPropertyAccess::get($target,$this->getProperty()) instanceof TList; |
|
| 312 | - return $this->getPropertyValueType() == self::LIST_TYPE; |
|
| 311 | + return TPropertyAccess::get($target, $this->getProperty()) instanceof TList; |
|
| 312 | + return $this->getPropertyValueType()==self::LIST_TYPE; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
@@ -322,28 +322,28 @@ discard block |
||
| 322 | 322 | { |
| 323 | 323 | if($this->getType()===null) |
| 324 | 324 | { |
| 325 | - $prop = TPropertyAccess::get($target,$this->getProperty()); |
|
| 325 | + $prop=TPropertyAccess::get($target, $this->getProperty()); |
|
| 326 | 326 | if(is_object($prop)) |
| 327 | 327 | return $prop instanceof \ArrayAccess; |
| 328 | 328 | return is_array($prop); |
| 329 | 329 | } |
| 330 | - return $this->getPropertyValueType() == self::ARRAY_TYPE; |
|
| 330 | + return $this->getPropertyValueType()==self::ARRAY_TYPE; |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | public function __sleep() |
| 334 | 334 | { |
| 335 | - $exprops = array(); $cn = 'TResultProperty'; |
|
| 336 | - if ($this->_nullValue===null) $exprops[] = "\0$cn\0_nullValue"; |
|
| 337 | - if ($this->_propertyName===null) $exprops[] = "\0$cn\0_propertyNama"; |
|
| 338 | - if ($this->_columnName===null) $exprops[] = "\0$cn\0_columnName"; |
|
| 339 | - if ($this->_columnIndex==-1) $exprops[] = "\0$cn\0_columnIndex"; |
|
| 340 | - if ($this->_nestedResultMapName===null) $exprops[] = "\0$cn\0_nestedResultMapName"; |
|
| 341 | - if ($this->_nestedResultMap===null) $exprops[] = "\0$cn\0_nestedResultMap"; |
|
| 342 | - if ($this->_valueType===null) $exprops[] = "\0$cn\0_valueType"; |
|
| 343 | - if ($this->_typeHandler===null) $exprops[] = "\0$cn\0_typeHandler"; |
|
| 344 | - if ($this->_isLazyLoad===false) $exprops[] = "\0$cn\0_isLazyLoad"; |
|
| 345 | - if ($this->_select===null) $exprops[] = "\0$cn\0_select"; |
|
| 346 | - return array_diff(parent::__sleep(),$exprops); |
|
| 335 | + $exprops=array(); $cn='TResultProperty'; |
|
| 336 | + if($this->_nullValue===null) $exprops[]="\0$cn\0_nullValue"; |
|
| 337 | + if($this->_propertyName===null) $exprops[]="\0$cn\0_propertyNama"; |
|
| 338 | + if($this->_columnName===null) $exprops[]="\0$cn\0_columnName"; |
|
| 339 | + if($this->_columnIndex==-1) $exprops[]="\0$cn\0_columnIndex"; |
|
| 340 | + if($this->_nestedResultMapName===null) $exprops[]="\0$cn\0_nestedResultMapName"; |
|
| 341 | + if($this->_nestedResultMap===null) $exprops[]="\0$cn\0_nestedResultMap"; |
|
| 342 | + if($this->_valueType===null) $exprops[]="\0$cn\0_valueType"; |
|
| 343 | + if($this->_typeHandler===null) $exprops[]="\0$cn\0_typeHandler"; |
|
| 344 | + if($this->_isLazyLoad===false) $exprops[]="\0$cn\0_isLazyLoad"; |
|
| 345 | + if($this->_select===null) $exprops[]="\0$cn\0_select"; |
|
| 346 | + return array_diff(parent::__sleep(), $exprops); |
|
| 347 | 347 | } |
| 348 | 348 | } |
| 349 | 349 | |
@@ -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; |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function clearCache() |
| 53 | 53 | { |
| 54 | - $cache = $this->getApplication()->getCache(); |
|
| 55 | - if($cache !== null) { |
|
| 54 | + $cache=$this->getApplication()->getCache(); |
|
| 55 | + if($cache!==null) { |
|
| 56 | 56 | $cache->delete($this->getCacheKey()); |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -66,16 +66,16 @@ discard block |
||
| 66 | 66 | * @since 3.1.7 |
| 67 | 67 | */ |
| 68 | 68 | public function getSqlMapManager() { |
| 69 | - if(($manager = $this->loadCachedSqlMapManager())===null) |
|
| 69 | + if(($manager=$this->loadCachedSqlMapManager())===null) |
|
| 70 | 70 | { |
| 71 | - $manager = new TSqlMapManager($this->getDbConnection()); |
|
| 71 | + $manager=new TSqlMapManager($this->getDbConnection()); |
|
| 72 | 72 | if(strlen($file=$this->getConfigFile()) > 0) |
| 73 | 73 | { |
| 74 | 74 | $manager->configureXml($file); |
| 75 | 75 | $this->cacheSqlMapManager($manager); |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | - elseif($this->getConnectionID() !== '') { |
|
| 78 | + elseif($this->getConnectionID()!=='') { |
|
| 79 | 79 | $manager->setDbConnection($this->getDbConnection()); |
| 80 | 80 | } |
| 81 | 81 | return $manager; |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | if($this->getEnableCache()) |
| 91 | 91 | { |
| 92 | - $cache = $this->getApplication()->getCache(); |
|
| 93 | - if($cache !== null) { |
|
| 94 | - $dependencies = null; |
|
| 95 | - if($this->getApplication()->getMode() !== TApplicationMode::Performance) |
|
| 96 | - $dependencies = $manager->getCacheDependencies(); |
|
| 92 | + $cache=$this->getApplication()->getCache(); |
|
| 93 | + if($cache!==null) { |
|
| 94 | + $dependencies=null; |
|
| 95 | + if($this->getApplication()->getMode()!==TApplicationMode::Performance) |
|
| 96 | + $dependencies=$manager->getCacheDependencies(); |
|
| 97 | 97 | return $cache->set($this->getCacheKey(), $manager, 0, $dependencies); |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -108,10 +108,10 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | if($this->getEnableCache()) |
| 110 | 110 | { |
| 111 | - $cache = $this->getApplication()->getCache(); |
|
| 112 | - if($cache !== null) |
|
| 111 | + $cache=$this->getApplication()->getCache(); |
|
| 112 | + if($cache!==null) |
|
| 113 | 113 | { |
| 114 | - $manager = $cache->get($this->getCacheKey()); |
|
| 114 | + $manager=$cache->get($this->getCacheKey()); |
|
| 115 | 115 | if($manager instanceof TSqlMapManager) |
| 116 | 116 | return $manager; |
| 117 | 117 | } |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | $this->_configFile=$value; |
| 139 | 139 | else |
| 140 | 140 | { |
| 141 | - $file = Prado::getPathOfNamespace($value,self::CONFIG_FILE_EXT); |
|
| 142 | - if($file === null || !is_file($file)) |
|
| 143 | - throw new TConfigurationException('sqlmap_configfile_invalid',$value); |
|
| 141 | + $file=Prado::getPathOfNamespace($value, self::CONFIG_FILE_EXT); |
|
| 142 | + if($file===null || !is_file($file)) |
|
| 143 | + throw new TConfigurationException('sqlmap_configfile_invalid', $value); |
|
| 144 | 144 | else |
| 145 | - $this->_configFile = $file; |
|
| 145 | + $this->_configFile=$file; |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function setEnableCache($value) |
| 154 | 154 | { |
| 155 | - $this->_enableCache = TPropertyValue::ensureBoolean($value); |
|
| 155 | + $this->_enableCache=TPropertyValue::ensureBoolean($value); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | public function getClient() |
| 179 | 179 | { |
| 180 | - if($this->_sqlmap===null ) |
|
| 180 | + if($this->_sqlmap===null) |
|
| 181 | 181 | $this->_sqlmap=$this->createSqlMapGateway(); |
| 182 | 182 | return $this->_sqlmap; |
| 183 | 183 | } |
@@ -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 | } |
@@ -68,8 +68,7 @@ |
||
| 68 | 68 | foreach($xml['database'] as $name=>$value) |
| 69 | 69 | $db->setSubProperty($name,$value); |
| 70 | 70 | } |
| 71 | - } |
|
| 72 | - else |
|
| 71 | + } else |
|
| 73 | 72 | { |
| 74 | 73 | if($prop=$xml->getElementByTagName('database')) |
| 75 | 74 | { |