@@ -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 |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function setClass($value) |
83 | 83 | { |
84 | - $this->_class = $value; |
|
84 | + $this->_class=$value; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function setExtends($value) |
107 | 107 | { |
108 | - $this->_extends = $value; |
|
108 | + $this->_extends=$value; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function setGroupBy($value) |
123 | 123 | { |
124 | - $this->_groupBy = $value; |
|
124 | + $this->_groupBy=$value; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function setDiscriminator(TDiscriminator $value) |
139 | 139 | { |
140 | - $this->_discriminator = $value; |
|
140 | + $this->_discriminator=$value; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function addResultProperty(TResultProperty $property) |
148 | 148 | { |
149 | - $this->_columns[$property->getProperty()] = $property; |
|
149 | + $this->_columns[$property->getProperty()]=$property; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function createInstanceOfResult($registry) |
159 | 159 | { |
160 | - $handler = $registry->getTypeHandler($this->getClass()); |
|
160 | + $handler=$registry->getTypeHandler($this->getClass()); |
|
161 | 161 | try |
162 | 162 | { |
163 | 163 | if($handler!==null) |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | else |
166 | 166 | return $registry->createInstanceOf($this->getClass()); |
167 | 167 | } |
168 | - catch (TSqlMapException $e) |
|
168 | + catch(TSqlMapException $e) |
|
169 | 169 | { |
170 | 170 | throw new TSqlMapException( |
171 | 171 | 'sqlmap_unable_to_create_new_instance', |
@@ -179,18 +179,18 @@ discard block |
||
179 | 179 | * @param array row data. |
180 | 180 | * @return TResultMap result sub-map. |
181 | 181 | */ |
182 | - public function resolveSubMap($registry,$row) |
|
182 | + public function resolveSubMap($registry, $row) |
|
183 | 183 | { |
184 | - $subMap = $this; |
|
185 | - if(($disc = $this->getDiscriminator())!==null) |
|
184 | + $subMap=$this; |
|
185 | + if(($disc=$this->getDiscriminator())!==null) |
|
186 | 186 | { |
187 | - $value = $disc->getMapping()->getPropertyValue($registry,$row); |
|
188 | - $subMap = $disc->getSubMap((string)$value); |
|
187 | + $value=$disc->getMapping()->getPropertyValue($registry, $row); |
|
188 | + $subMap=$disc->getSubMap((string) $value); |
|
189 | 189 | |
190 | 190 | if($subMap===null) |
191 | - $subMap = $this; |
|
192 | - else if($subMap !== $this) |
|
193 | - $subMap = $subMap->resolveSubMap($registry,$row); |
|
191 | + $subMap=$this; |
|
192 | + else if($subMap!==$this) |
|
193 | + $subMap=$subMap->resolveSubMap($registry, $row); |
|
194 | 194 | } |
195 | 195 | return $subMap; |
196 | 196 | } |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | */ |
20 | 20 | class TSimpleDynamicParser |
21 | 21 | { |
22 | - const PARAMETER_TOKEN_REGEXP = '/\$([^\$]+)\$/'; |
|
23 | - const DYNAMIC_TOKEN = '`!`'; |
|
22 | + const PARAMETER_TOKEN_REGEXP='/\$([^\$]+)\$/'; |
|
23 | + const DYNAMIC_TOKEN='`!`'; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Parse the sql text for dynamic place holders of the form $name$. |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function parse($sqlText) |
31 | 31 | { |
32 | - $matches = array(); |
|
33 | - $mappings = array(); |
|
32 | + $matches=array(); |
|
33 | + $mappings=array(); |
|
34 | 34 | preg_match_all(self::PARAMETER_TOKEN_REGEXP, $sqlText, $matches); |
35 | - for($i = 0, $k=count($matches[1]); $i<$k; $i++) |
|
35 | + for($i=0, $k=count($matches[1]); $i < $k; $i++) |
|
36 | 36 | { |
37 | - $mappings[] = $matches[1][$i]; |
|
38 | - $sqlText = str_replace($matches[0][$i], self::DYNAMIC_TOKEN, $sqlText); |
|
37 | + $mappings[]=$matches[1][$i]; |
|
38 | + $sqlText=str_replace($matches[0][$i], self::DYNAMIC_TOKEN, $sqlText); |
|
39 | 39 | } |
40 | 40 | return array('sql'=>$sqlText, 'parameters'=>$mappings); |
41 | 41 | } |
@@ -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 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * Regular expression for parsing inline parameter maps. |
27 | 27 | */ |
28 | - const PARAMETER_TOKEN_REGEXP = '/#([^#]+)#/'; |
|
28 | + const PARAMETER_TOKEN_REGEXP='/#([^#]+)#/'; |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Parse the sql text for inline parameters. |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function parse($sqlText, $scope) |
37 | 37 | { |
38 | - $matches = array(); |
|
39 | - $mappings = array(); |
|
38 | + $matches=array(); |
|
39 | + $mappings=array(); |
|
40 | 40 | preg_match_all(self::PARAMETER_TOKEN_REGEXP, $sqlText, $matches); |
41 | 41 | |
42 | - for($i = 0, $k=count($matches[1]); $i<$k; $i++) |
|
42 | + for($i=0, $k=count($matches[1]); $i < $k; $i++) |
|
43 | 43 | { |
44 | - $mappings[] = $this->parseMapping($matches[1][$i], $scope); |
|
45 | - $sqlText = str_replace($matches[0][$i], '?', $sqlText); |
|
44 | + $mappings[]=$this->parseMapping($matches[1][$i], $scope); |
|
45 | + $sqlText=str_replace($matches[0][$i], '?', $sqlText); |
|
46 | 46 | } |
47 | 47 | return array('sql'=>$sqlText, 'parameters'=>$mappings); |
48 | 48 | } |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | */ |
56 | 56 | protected function parseMapping($token, $scope) |
57 | 57 | { |
58 | - $mapping = new TParameterProperty; |
|
59 | - $properties = explode(',', $token); |
|
58 | + $mapping=new TParameterProperty; |
|
59 | + $properties=explode(',', $token); |
|
60 | 60 | $mapping->setProperty(trim(array_shift($properties))); |
61 | 61 | foreach($properties as $property) |
62 | 62 | { |
63 | - $prop = explode('=',$property); |
|
64 | - $name = trim($prop[0]); $value=trim($prop[1]); |
|
63 | + $prop=explode('=', $property); |
|
64 | + $name=trim($prop[0]); $value=trim($prop[1]); |
|
65 | 65 | if($mapping->canSetProperty($name)) |
66 | 66 | $mapping->{'set'.$name}($value); |
67 | 67 | else |
@@ -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 | } |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | public function bindColumn($column, &$value, $dataType=null) |
64 | 64 | { |
65 | 65 | if($dataType===null) |
66 | - $this->_statement->bindColumn($column,$value); |
|
66 | + $this->_statement->bindColumn($column, $value); |
|
67 | 67 | else |
68 | - $this->_statement->bindColumn($column,$value,$dataType); |
|
68 | + $this->_statement->bindColumn($column, $value, $dataType); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | public function setFetchMode($mode) |
75 | 75 | { |
76 | 76 | $params=func_get_args(); |
77 | - call_user_func_array(array($this->_statement,'setFetchMode'),$params); |
|
77 | + call_user_func_array(array($this->_statement, 'setFetchMode'), $params); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | * @param array list of column names whose values are to be passed as parameters in the constructor of the class being created |
103 | 103 | * @return mixed|false the populated object, false if no more row of data available |
104 | 104 | */ |
105 | - public function readObject($className,$fields) |
|
105 | + public function readObject($className, $fields) |
|
106 | 106 | { |
107 | - return $this->_statement->fetchObject($className,$fields); |
|
107 | + return $this->_statement->fetchObject($className, $fields); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function rewind() |
173 | 173 | { |
174 | - if($this->_index<0) |
|
174 | + if($this->_index < 0) |
|
175 | 175 | { |
176 | 176 | $this->_row=$this->_statement->fetch(); |
177 | 177 | $this->_index=0; |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | public function __construct($condition=null, $parameters=array()) |
49 | 49 | { |
50 | 50 | if(!is_array($parameters) && func_num_args() > 1) |
51 | - $parameters = array_slice(func_get_args(),1); |
|
51 | + $parameters=array_slice(func_get_args(), 1); |
|
52 | 52 | $this->_parameters=new TAttributeCollection; |
53 | 53 | $this->_parameters->setCaseSensitive(true); |
54 | - $this->_parameters->copyFrom((array)$parameters); |
|
54 | + $this->_parameters->copyFrom((array) $parameters); |
|
55 | 55 | $this->_ordersBy=new TAttributeCollection; |
56 | 56 | $this->_ordersBy->setCaseSensitive(true); |
57 | 57 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function setSelect($value) |
111 | 111 | { |
112 | - $this->_select = $value; |
|
112 | + $this->_select=$value; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | { |
129 | 129 | if(empty($value)) { |
130 | 130 | // reset the condition |
131 | - $this->_condition = null; |
|
131 | + $this->_condition=null; |
|
132 | 132 | return; |
133 | 133 | } |
134 | 134 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | if(preg_match('/ORDER\s+BY\s+(.*?)(?=LIMIT)|ORDER\s+BY\s+(.*?)$/i', $value, $matches) > 0) { |
142 | 142 | // condition contains ORDER BY |
143 | - $value = str_replace($matches[0], '', $value); |
|
143 | + $value=str_replace($matches[0], '', $value); |
|
144 | 144 | if(strlen($matches[1]) > 0) { |
145 | 145 | $this->setOrdersBy($matches[1]); |
146 | 146 | } else if(strlen($matches[2]) > 0) { |
@@ -150,23 +150,23 @@ discard block |
||
150 | 150 | |
151 | 151 | if(preg_match('/LIMIT\s+([\d\s,]+)/i', $value, $matches) > 0) { |
152 | 152 | // condition contains limit |
153 | - $value = str_replace($matches[0], '', $value); // remove limit from query |
|
153 | + $value=str_replace($matches[0], '', $value); // remove limit from query |
|
154 | 154 | if(strpos($matches[1], ',')) { // both offset and limit given |
155 | - list($offset, $limit) = explode(',', $matches[1]); |
|
156 | - $this->_limit = (int)$limit; |
|
157 | - $this->_offset = (int)$offset; |
|
155 | + list($offset, $limit)=explode(',', $matches[1]); |
|
156 | + $this->_limit=(int) $limit; |
|
157 | + $this->_offset=(int) $offset; |
|
158 | 158 | } else { // only limit given |
159 | - $this->_limit = (int)$matches[1]; |
|
159 | + $this->_limit=(int) $matches[1]; |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | 163 | if(preg_match('/OFFSET\s+(\d+)/i', $value, $matches) > 0) { |
164 | 164 | // condition contains offset |
165 | - $value = str_replace($matches[0], '', $value); // remove offset from query |
|
166 | - $this->_offset = (int)$matches[1]; // set offset in criteria |
|
165 | + $value=str_replace($matches[0], '', $value); // remove offset from query |
|
166 | + $this->_offset=(int) $matches[1]; // set offset in criteria |
|
167 | 167 | } |
168 | 168 | |
169 | - $this->_condition = trim($value); |
|
169 | + $this->_condition=trim($value); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -213,12 +213,12 @@ discard block |
||
213 | 213 | $this->_ordersBy->copyFrom($value); |
214 | 214 | else |
215 | 215 | { |
216 | - $value=trim(preg_replace('/\s+/',' ',(string)$value)); |
|
216 | + $value=trim(preg_replace('/\s+/', ' ', (string) $value)); |
|
217 | 217 | $orderBys=array(); |
218 | - foreach(explode(',',$value) as $orderBy) |
|
218 | + foreach(explode(',', $value) as $orderBy) |
|
219 | 219 | { |
220 | - $vs=explode(' ',trim($orderBy)); |
|
221 | - $orderBys[$vs[0]]=isset($vs[1])?$vs[1]:'asc'; |
|
220 | + $vs=explode(' ', trim($orderBy)); |
|
221 | + $orderBys[$vs[0]]=isset($vs[1]) ? $vs[1] : 'asc'; |
|
222 | 222 | } |
223 | 223 | $this->_ordersBy->copyFrom($orderBys); |
224 | 224 | } |
@@ -261,23 +261,23 @@ discard block |
||
261 | 261 | */ |
262 | 262 | public function __toString() |
263 | 263 | { |
264 | - $str = ''; |
|
265 | - if(strlen((string)$this->getCondition()) > 0) |
|
266 | - $str .= '"'.(string)$this->getCondition().'"'; |
|
267 | - $params = array(); |
|
264 | + $str=''; |
|
265 | + if(strlen((string) $this->getCondition()) > 0) |
|
266 | + $str.='"'.(string) $this->getCondition().'"'; |
|
267 | + $params=array(); |
|
268 | 268 | foreach($this->getParameters() as $k=>$v) |
269 | - $params[] = "{$k} => ${v}"; |
|
269 | + $params[]="{$k} => ${v}"; |
|
270 | 270 | if(count($params) > 0) |
271 | - $str .= ', "'.implode(', ',$params).'"'; |
|
272 | - $orders = array(); |
|
271 | + $str.=', "'.implode(', ', $params).'"'; |
|
272 | + $orders=array(); |
|
273 | 273 | foreach($this->getOrdersBy() as $k=>$v) |
274 | - $orders[] = "{$k} => ${v}"; |
|
274 | + $orders[]="{$k} => ${v}"; |
|
275 | 275 | if(count($orders) > 0) |
276 | - $str .= ', "'.implode(', ',$orders).'"'; |
|
277 | - if($this->_limit !==null) |
|
278 | - $str .= ', '.$this->_limit; |
|
279 | - if($this->_offset !== null) |
|
280 | - $str .= ', '.$this->_offset; |
|
276 | + $str.=', "'.implode(', ', $orders).'"'; |
|
277 | + if($this->_limit!==null) |
|
278 | + $str.=', '.$this->_limit; |
|
279 | + if($this->_offset!==null) |
|
280 | + $str.=', '.$this->_offset; |
|
281 | 281 | return $str; |
282 | 282 | } |
283 | 283 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @param string|TDbTableInfo table or view name or table information. |
88 | 88 | * @param TDbConnection database connection. |
89 | 89 | */ |
90 | - public function __construct($table,$connection) |
|
90 | + public function __construct($table, $connection) |
|
91 | 91 | { |
92 | 92 | $this->_connection=$connection; |
93 | 93 | if(is_string($table)) |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | protected function setTableInfo($tableInfo) |
105 | 105 | { |
106 | - $builder = $tableInfo->createCommandBuilder($this->getDbConnection()); |
|
106 | + $builder=$tableInfo->createCommandBuilder($this->getDbConnection()); |
|
107 | 107 | $this->initCommandBuilder($builder); |
108 | 108 | } |
109 | 109 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | protected function setTableName($tableName) |
115 | 115 | { |
116 | 116 | Prado::using('System.Data.Common.TDbMetaData'); |
117 | - $meta = TDbMetaData::getInstance($this->getDbConnection()); |
|
117 | + $meta=TDbMetaData::getInstance($this->getDbConnection()); |
|
118 | 118 | $this->initCommandBuilder($meta->createCommandBuilder($tableName)); |
119 | 119 | } |
120 | 120 | |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | */ |
134 | 134 | protected function initCommandBuilder($builder) |
135 | 135 | { |
136 | - $this->_command = new TDataGatewayCommand($builder); |
|
137 | - $this->_command->OnCreateCommand[] = array($this, 'onCreateCommand'); |
|
138 | - $this->_command->OnExecuteCommand[] = array($this, 'onExecuteCommand'); |
|
136 | + $this->_command=new TDataGatewayCommand($builder); |
|
137 | + $this->_command->OnCreateCommand[]=array($this, 'onCreateCommand'); |
|
138 | + $this->_command->OnExecuteCommand[]=array($this, 'onExecuteCommand'); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function findBySql($sql, $parameters=array()) |
191 | 191 | { |
192 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
193 | - $criteria = $this->getCriteria($sql,$parameters, $args); |
|
192 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
193 | + $criteria=$this->getCriteria($sql, $parameters, $args); |
|
194 | 194 | return $this->getCommand()->findBySql($criteria); |
195 | 195 | } |
196 | 196 | |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function findAllBySql($sql, $parameters=array()) |
204 | 204 | { |
205 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
206 | - $criteria = $this->getCriteria($sql,$parameters, $args); |
|
205 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
206 | + $criteria=$this->getCriteria($sql, $parameters, $args); |
|
207 | 207 | return $this->getCommand()->findAllBySql($criteria); |
208 | 208 | } |
209 | 209 | |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | */ |
227 | 227 | public function find($criteria, $parameters=array()) |
228 | 228 | { |
229 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
230 | - $criteria = $this->getCriteria($criteria,$parameters, $args); |
|
229 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
230 | + $criteria=$this->getCriteria($criteria, $parameters, $args); |
|
231 | 231 | return $this->getCommand()->find($criteria); |
232 | 232 | } |
233 | 233 | |
@@ -239,9 +239,9 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function findAll($criteria=null, $parameters=array()) |
241 | 241 | { |
242 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
242 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
243 | 243 | if($criteria!==null) |
244 | - $criteria = $this->getCriteria($criteria,$parameters, $args); |
|
244 | + $criteria=$this->getCriteria($criteria, $parameters, $args); |
|
245 | 245 | return $this->getCommand()->findAll($criteria); |
246 | 246 | } |
247 | 247 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | public function findByPk($keys) |
261 | 261 | { |
262 | 262 | if(func_num_args() > 1) |
263 | - $keys = func_get_args(); |
|
263 | + $keys=func_get_args(); |
|
264 | 264 | return $this->getCommand()->findByPk($keys); |
265 | 265 | } |
266 | 266 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | public function findAllByPks($keys) |
285 | 285 | { |
286 | 286 | if(func_num_args() > 1) |
287 | - $keys = func_get_args(); |
|
287 | + $keys=func_get_args(); |
|
288 | 288 | return $this->getCommand()->findAllByPk($keys); |
289 | 289 | } |
290 | 290 | |
@@ -301,8 +301,8 @@ discard block |
||
301 | 301 | */ |
302 | 302 | public function deleteAll($criteria, $parameters=array()) |
303 | 303 | { |
304 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
305 | - $criteria = $this->getCriteria($criteria,$parameters, $args); |
|
304 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
305 | + $criteria=$this->getCriteria($criteria, $parameters, $args); |
|
306 | 306 | return $this->getCommand()->delete($criteria); |
307 | 307 | } |
308 | 308 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | public function deleteByPk($keys) |
333 | 333 | { |
334 | 334 | if(func_num_args() > 1) |
335 | - $keys = func_get_args(); |
|
335 | + $keys=func_get_args(); |
|
336 | 336 | return $this->getCommand()->deleteByPk($keys); |
337 | 337 | } |
338 | 338 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | public function deleteAllByPks($keys) |
343 | 343 | { |
344 | 344 | if(func_num_args() > 1) |
345 | - $keys = func_get_args(); |
|
345 | + $keys=func_get_args(); |
|
346 | 346 | return $this->deleteByPk($keys); |
347 | 347 | } |
348 | 348 | |
@@ -352,11 +352,11 @@ discard block |
||
352 | 352 | * @param mixed parameter values. |
353 | 353 | * @return int number of records. |
354 | 354 | */ |
355 | - public function count($criteria=null,$parameters=array()) |
|
355 | + public function count($criteria=null, $parameters=array()) |
|
356 | 356 | { |
357 | - $args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null; |
|
357 | + $args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
|
358 | 358 | if($criteria!==null) |
359 | - $criteria = $this->getCriteria($criteria,$parameters, $args); |
|
359 | + $criteria=$this->getCriteria($criteria, $parameters, $args); |
|
360 | 360 | return $this->getCommand()->count($criteria); |
361 | 361 | } |
362 | 362 | |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | */ |
377 | 377 | public function update($data, $criteria, $parameters=array()) |
378 | 378 | { |
379 | - $args = func_num_args() > 2 ? array_slice(func_get_args(),2) : null; |
|
380 | - $criteria = $this->getCriteria($criteria,$parameters, $args); |
|
379 | + $args=func_num_args() > 2 ? array_slice(func_get_args(), 2) : null; |
|
380 | + $criteria=$this->getCriteria($criteria, $parameters, $args); |
|
381 | 381 | return $this->getCommand()->update($data, $criteria); |
382 | 382 | } |
383 | 383 | |
@@ -414,8 +414,8 @@ discard block |
||
414 | 414 | { |
415 | 415 | if(is_string($criteria)) |
416 | 416 | { |
417 | - $useArgs = !is_array($parameters) && is_array($args); |
|
418 | - return new TSqlCriteria($criteria,$useArgs ? $args : $parameters); |
|
417 | + $useArgs=!is_array($parameters) && is_array($args); |
|
418 | + return new TSqlCriteria($criteria, $useArgs ? $args : $parameters); |
|
419 | 419 | } |
420 | 420 | else if($criteria instanceof TSqlCriteria) |
421 | 421 | return $criteria; |
@@ -452,21 +452,21 @@ discard block |
||
452 | 452 | * @return mixed single record if method name starts with "findBy", 0 or more records |
453 | 453 | * if method name starts with "findAllBy" |
454 | 454 | */ |
455 | - public function __call($method,$args) |
|
455 | + public function __call($method, $args) |
|
456 | 456 | { |
457 | - $delete =false; |
|
458 | - if($findOne = substr(strtolower($method),0,6)==='findby') |
|
459 | - $condition = $method[6]==='_' ? substr($method,7) : substr($method,6); |
|
460 | - else if(substr(strtolower($method),0,9)==='findallby') |
|
461 | - $condition = $method[9]==='_' ? substr($method,10) : substr($method,9); |
|
462 | - else if($delete = substr(strtolower($method),0,8)==='deleteby') |
|
463 | - $condition = $method[8]==='_' ? substr($method,9) : substr($method,8); |
|
464 | - else if($delete = substr(strtolower($method),0,11)==='deleteallby') |
|
465 | - $condition = $method[11]==='_' ? substr($method,12) : substr($method,11); |
|
457 | + $delete=false; |
|
458 | + if($findOne=substr(strtolower($method), 0, 6)==='findby') |
|
459 | + $condition=$method[6]==='_' ? substr($method, 7) : substr($method, 6); |
|
460 | + else if(substr(strtolower($method), 0, 9)==='findallby') |
|
461 | + $condition=$method[9]==='_' ? substr($method, 10) : substr($method, 9); |
|
462 | + else if($delete=substr(strtolower($method), 0, 8)==='deleteby') |
|
463 | + $condition=$method[8]==='_' ? substr($method, 9) : substr($method, 8); |
|
464 | + else if($delete=substr(strtolower($method), 0, 11)==='deleteallby') |
|
465 | + $condition=$method[11]==='_' ? substr($method, 12) : substr($method, 11); |
|
466 | 466 | else |
467 | 467 | return null; |
468 | 468 | |
469 | - $criteria = $this->getCommand()->createCriteriaFromString($method, $condition, $args); |
|
469 | + $criteria=$this->getCommand()->createCriteriaFromString($method, $condition, $args); |
|
470 | 470 | if($delete) |
471 | 471 | return $this->deleteAll($criteria); |
472 | 472 | else |