@@ -33,18 +33,18 @@ discard block |
||
33 | 33 | class TSqlMapCacheModel extends TComponent |
34 | 34 | { |
35 | 35 | private $_cache; |
36 | - private $_hits = 0; |
|
37 | - private $_requests = 0; |
|
36 | + private $_hits=0; |
|
37 | + private $_requests=0; |
|
38 | 38 | private $_id; |
39 | 39 | private $_implementation=TSqlMapCacheTypes::Basic; |
40 | - private $_properties = array(); |
|
41 | - private $_flushInterval = 0; |
|
40 | + private $_properties=array(); |
|
41 | + private $_flushInterval=0; |
|
42 | 42 | |
43 | - private static $_cacheTypes = array(); |
|
43 | + private static $_cacheTypes=array(); |
|
44 | 44 | |
45 | 45 | public static function registerCacheType($type, $className) |
46 | 46 | { |
47 | - self::$_cacheTypes[$type] = $className; |
|
47 | + self::$_cacheTypes[$type]=$className; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function setID($value) |
62 | 62 | { |
63 | - $this->_id = $value; |
|
63 | + $this->_id=$value; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function setImplementation($value) |
78 | 78 | { |
79 | - if (isset(self::$_cacheTypes[$value])) |
|
80 | - $this->_implementation = $value; |
|
79 | + if(isset(self::$_cacheTypes[$value])) |
|
80 | + $this->_implementation=$value; |
|
81 | 81 | else |
82 | - $this->_implementation = TPropertyValue::ensureEnum($value,'TSqlMapCacheTypes'); |
|
82 | + $this->_implementation=TPropertyValue::ensureEnum($value, 'TSqlMapCacheTypes'); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | public function initialize($cache=null) |
106 | 106 | { |
107 | 107 | if($cache===null) |
108 | - $this->_cache= Prado::createComponent($this->getImplementationClass(), $this); |
|
108 | + $this->_cache=Prado::createComponent($this->getImplementationClass(), $this); |
|
109 | 109 | else |
110 | 110 | $this->_cache=$cache; |
111 | 111 | } |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function getImplementationClass() |
117 | 117 | { |
118 | - $implementation = $this->_implementation; |
|
119 | - if (isset(self::$_cacheTypes[$implementation])) return self::$_cacheTypes[$implementation]; |
|
118 | + $implementation=$this->_implementation; |
|
119 | + if(isset(self::$_cacheTypes[$implementation])) return self::$_cacheTypes[$implementation]; |
|
120 | 120 | |
121 | - switch(TPropertyValue::ensureEnum($implementation,'TSqlMapCacheTypes')) |
|
121 | + switch(TPropertyValue::ensureEnum($implementation, 'TSqlMapCacheTypes')) |
|
122 | 122 | { |
123 | 123 | case TSqlMapCacheTypes::FIFO: return 'TSqlMapFifoCache'; |
124 | 124 | case TSqlMapCacheTypes::LRU : return 'TSqlMapLruCache'; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function registerTriggerStatement($mappedStatement) |
134 | 134 | { |
135 | - $mappedStatement->attachEventHandler('OnExecuteQuery',array($this, 'flush')); |
|
135 | + $mappedStatement->attachEventHandler('OnExecuteQuery', array($this, 'flush')); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | public function get($key) |
151 | 151 | { |
152 | 152 | if($key instanceof TSqlMapCacheKey) |
153 | - $key = $key->getHash(); |
|
153 | + $key=$key->getHash(); |
|
154 | 154 | |
155 | 155 | //if flush ? |
156 | - $value = $this->_cache->get($key); |
|
156 | + $value=$this->_cache->get($key); |
|
157 | 157 | $this->_requests++; |
158 | 158 | if($value!==null) |
159 | 159 | $this->_hits++; |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | public function set($key, $value) |
168 | 168 | { |
169 | 169 | if($key instanceof TSqlMapCacheKey) |
170 | - $key = $key->getHash(); |
|
170 | + $key=$key->getHash(); |
|
171 | 171 | |
172 | 172 | if($value!==null) |
173 | 173 | $this->_cache->set($key, $value, $this->_flushInterval); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function getHitRatio() |
180 | 180 | { |
181 | - if($this->_requests != 0) |
|
181 | + if($this->_requests!=0) |
|
182 | 182 | return $this->_hits / $this->_requests; |
183 | 183 | else |
184 | 184 | return 0; |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public function __construct($object) |
221 | 221 | { |
222 | - $this->_key = $this->generateKey(serialize($object)); |
|
222 | + $this->_key=$this->generateKey(serialize($object)); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | protected function generateKey($string) |
230 | 230 | { |
231 | - return sprintf('%x',crc32($string)); |
|
231 | + return sprintf('%x', crc32($string)); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -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 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function setColumn($value) |
51 | 51 | { |
52 | - $this->_column = $value; |
|
52 | + $this->_column=$value; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function setType($value) |
71 | 71 | { |
72 | - $this->_type = $value; |
|
72 | + $this->_type=$value; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function setTypeHandler($value) |
87 | 87 | { |
88 | - $this->_typeHandler = $value; |
|
88 | + $this->_typeHandler=$value; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function setColumnIndex($value) |
105 | 105 | { |
106 | - $this->_columnIndex = TPropertyValue::ensureInteger($value); |
|
106 | + $this->_columnIndex=TPropertyValue::ensureInteger($value); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function setNullValue($value) |
121 | 121 | { |
122 | - $this->_nullValue = $value; |
|
122 | + $this->_nullValue=$value; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function addSubMap($subMap) |
137 | 137 | { |
138 | - $this->_subMaps[] = $subMap; |
|
138 | + $this->_subMaps[]=$subMap; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function initMapping($resultMap) |
156 | 156 | { |
157 | - $this->_mapping = new TResultProperty($resultMap); |
|
157 | + $this->_mapping=new TResultProperty($resultMap); |
|
158 | 158 | $this->_mapping->setColumn($this->getColumn()); |
159 | 159 | $this->_mapping->setColumnIndex($this->getColumnIndex()); |
160 | 160 | $this->_mapping->setType($this->getType()); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | { |
171 | 171 | foreach($this->_subMaps as $subMap) |
172 | 172 | { |
173 | - $this->_resultMaps[$subMap->getValue()] = |
|
173 | + $this->_resultMaps[$subMap->getValue()]= |
|
174 | 174 | $manager->getResultMap($subMap->getResultMapping()); |
175 | 175 | } |
176 | 176 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function setValue($value) |
208 | 208 | { |
209 | - $this->_value = $value; |
|
209 | + $this->_value=$value; |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public function setResultMapping($value) |
225 | 225 | { |
226 | - $this->_resultMapping = $value; |
|
226 | + $this->_resultMapping=$value; |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 |
@@ -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 |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function setParameterMap($value) |
75 | 75 | { |
76 | - $this->_parameterMapName = $value; |
|
76 | + $this->_parameterMapName=$value; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function setParameterClass($value) |
94 | 94 | { |
95 | - $this->_parameterClassName = $value; |
|
95 | + $this->_parameterClassName=$value; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function setResultMap($value) |
112 | 112 | { |
113 | - $this->_resultMapName = $value; |
|
113 | + $this->_resultMapName=$value; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function setResultClass($value) |
133 | 133 | { |
134 | - $this->_resultClassName = $value; |
|
134 | + $this->_resultClassName=$value; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function setCacheModel($value) |
149 | 149 | { |
150 | - $this->_cacheModelName = $value; |
|
150 | + $this->_cacheModelName=$value; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function setCache($value) |
165 | 165 | { |
166 | - $this->_cache = $value; |
|
166 | + $this->_cache=$value; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function setSqlText($value) |
181 | 181 | { |
182 | - $this->_SQL = $value; |
|
182 | + $this->_SQL=$value; |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function setListClass($value) |
198 | 198 | { |
199 | - $this->_listClass = $value; |
|
199 | + $this->_listClass=$value; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function setExtends($value) |
214 | 214 | { |
215 | - $this->_extendStatement = $value; |
|
215 | + $this->_extendStatement=$value; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function setInlineParameterMap($map) |
240 | 240 | { |
241 | - $this->_parameterMap = $map; |
|
241 | + $this->_parameterMap=$map; |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -247,9 +247,9 @@ discard block |
||
247 | 247 | public function initialize($manager) |
248 | 248 | { |
249 | 249 | if(strlen($this->_resultMapName) > 0) |
250 | - $this->_resultMap = $manager->getResultMap($this->_resultMapName); |
|
250 | + $this->_resultMap=$manager->getResultMap($this->_resultMapName); |
|
251 | 251 | if(strlen($this->_parameterMapName) > 0) |
252 | - $this->_parameterMap = $manager->getParameterMap($this->_parameterMapName); |
|
252 | + $this->_parameterMap=$manager->getParameterMap($this->_parameterMapName); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | /** |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function createInstanceOfListClass($registry) |
260 | 260 | { |
261 | - if(strlen($type = $this->getListClass()) > 0) |
|
262 | - return $this->createInstanceOf($registry,$type); |
|
261 | + if(strlen($type=$this->getListClass()) > 0) |
|
262 | + return $this->createInstanceOf($registry, $type); |
|
263 | 263 | return array(); |
264 | 264 | } |
265 | 265 | |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | * @param array result data. |
271 | 271 | * @return mixed result object. |
272 | 272 | */ |
273 | - protected function createInstanceOf($registry,$type,$row=null) |
|
273 | + protected function createInstanceOf($registry, $type, $row=null) |
|
274 | 274 | { |
275 | - $handler = $registry->getTypeHandler($type); |
|
275 | + $handler=$registry->getTypeHandler($type); |
|
276 | 276 | if($handler!==null) |
277 | 277 | return $handler->createNewInstance($row); |
278 | 278 | else |
@@ -285,30 +285,30 @@ discard block |
||
285 | 285 | * @param array result data. |
286 | 286 | * @return mixed result object. |
287 | 287 | */ |
288 | - public function createInstanceOfResultClass($registry,$row) |
|
288 | + public function createInstanceOfResultClass($registry, $row) |
|
289 | 289 | { |
290 | - if(strlen($type= $this->getResultClass()) > 0) |
|
291 | - return $this->createInstanceOf($registry,$type,$row); |
|
290 | + if(strlen($type=$this->getResultClass()) > 0) |
|
291 | + return $this->createInstanceOf($registry, $type, $row); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | public function __sleep() |
295 | 295 | { |
296 | - $cn = __CLASS__; |
|
297 | - $exprops = array("\0$cn\0_resultMap"); |
|
298 | - if (!$this->_parameterMapName) $exprops[] = "\0$cn\0_parameterMapName"; |
|
299 | - if (!$this->_parameterMap) $exprops[] = "\0$cn\0_parameterMap"; |
|
300 | - if (!$this->_parameterClassName) $exprops[] = "\0$cn\0_parameterClassName"; |
|
301 | - if (!$this->_resultMapName) $exprops[] = "\0$cn\0_resultMapName"; |
|
302 | - if (!$this->_resultMap) $exprops[] = "\0$cn\0_resultMap"; |
|
303 | - if (!$this->_resultClassName) $exprops[] = "\0$cn\0_resultClassName"; |
|
304 | - if (!$this->_cacheModelName) $exprops[] = "\0$cn\0_cacheModelName"; |
|
305 | - if (!$this->_SQL) $exprops[] = "\0$cn\0_SQL"; |
|
306 | - if (!$this->_listClass) $exprops[] = "\0$cn\0_listClass"; |
|
307 | - if (!$this->_typeHandler) $exprops[] = "\0$cn\0_typeHandler"; |
|
308 | - if (!$this->_extendStatement) $exprops[] = "\0$cn\0_extendStatement"; |
|
309 | - if (!$this->_cache) $exprops[] = "\0$cn\0_cache"; |
|
296 | + $cn=__CLASS__; |
|
297 | + $exprops=array("\0$cn\0_resultMap"); |
|
298 | + if(!$this->_parameterMapName) $exprops[]="\0$cn\0_parameterMapName"; |
|
299 | + if(!$this->_parameterMap) $exprops[]="\0$cn\0_parameterMap"; |
|
300 | + if(!$this->_parameterClassName) $exprops[]="\0$cn\0_parameterClassName"; |
|
301 | + if(!$this->_resultMapName) $exprops[]="\0$cn\0_resultMapName"; |
|
302 | + if(!$this->_resultMap) $exprops[]="\0$cn\0_resultMap"; |
|
303 | + if(!$this->_resultClassName) $exprops[]="\0$cn\0_resultClassName"; |
|
304 | + if(!$this->_cacheModelName) $exprops[]="\0$cn\0_cacheModelName"; |
|
305 | + if(!$this->_SQL) $exprops[]="\0$cn\0_SQL"; |
|
306 | + if(!$this->_listClass) $exprops[]="\0$cn\0_listClass"; |
|
307 | + if(!$this->_typeHandler) $exprops[]="\0$cn\0_typeHandler"; |
|
308 | + if(!$this->_extendStatement) $exprops[]="\0$cn\0_extendStatement"; |
|
309 | + if(!$this->_cache) $exprops[]="\0$cn\0_cache"; |
|
310 | 310 | |
311 | - return array_diff(parent::__sleep(),$exprops); |
|
311 | + return array_diff(parent::__sleep(), $exprops); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | } |
@@ -324,8 +324,8 @@ discard block |
||
324 | 324 | { |
325 | 325 | private $_generate; |
326 | 326 | |
327 | - public function getGenerate(){ return $this->_generate; } |
|
328 | - public function setGenerate($value){ $this->_generate = $value; } |
|
327 | + public function getGenerate() { return $this->_generate; } |
|
328 | + public function setGenerate($value) { $this->_generate=$value; } |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | */ |
356 | 356 | public function setSelectKey($value) |
357 | 357 | { |
358 | - $this->_selectKey = $value; |
|
358 | + $this->_selectKey=$value; |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | */ |
391 | 391 | class TSqlMapSelectKey extends TSqlMapStatement |
392 | 392 | { |
393 | - private $_type = 'post'; |
|
393 | + private $_type='post'; |
|
394 | 394 | private $_property; |
395 | 395 | |
396 | 396 | /** |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | */ |
407 | 407 | public function setType($value) |
408 | 408 | { |
409 | - $this->_type = strtolower($value) == 'post' ? 'post' : 'pre'; |
|
409 | + $this->_type=strtolower($value)=='post' ? 'post' : 'pre'; |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | /** |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | */ |
423 | 423 | public function setProperty($value) |
424 | 424 | { |
425 | - $this->_property = $value; |
|
425 | + $this->_property=$value; |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | /** |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | */ |
439 | 439 | public function getIsAfter() |
440 | 440 | { |
441 | - return $this->_type == 'post'; |
|
441 | + return $this->_type=='post'; |
|
442 | 442 | } |
443 | 443 | } |
444 | 444 |
@@ -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 | } |