@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function registerTypeHandler(TSqlMapTypeHandler $handler) |
49 | 49 | { |
50 | - $this->_typeHandlers[$handler->getType()] = $handler; |
|
50 | + $this->_typeHandlers[$handler->getType()]=$handler; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | switch(strtolower($type)) |
91 | 91 | { |
92 | 92 | case 'integer': case 'int': |
93 | - $type = 'integer'; break; |
|
93 | + $type='integer'; break; |
|
94 | 94 | case 'float': case 'double': case 'decimal': |
95 | - $type = 'float'; break; |
|
95 | + $type='float'; break; |
|
96 | 96 | case 'boolean': case 'bool': |
97 | - $type = 'boolean'; break; |
|
97 | + $type='boolean'; break; |
|
98 | 98 | case 'string' : |
99 | - $type = 'string'; break; |
|
99 | + $type='string'; break; |
|
100 | 100 | default: |
101 | 101 | return $value; |
102 | 102 | } |
@@ -48,34 +48,34 @@ discard block |
||
48 | 48 | * @return mixed property value. |
49 | 49 | * @throws TInvalidDataValueException if property path is invalid. |
50 | 50 | */ |
51 | - public static function get($object,$path) |
|
51 | + public static function get($object, $path) |
|
52 | 52 | { |
53 | 53 | if(!is_array($object) && !is_object($object)) |
54 | 54 | return $object; |
55 | - $properties = explode('.', $path); |
|
55 | + $properties=explode('.', $path); |
|
56 | 56 | foreach($properties as $prop) |
57 | 57 | { |
58 | 58 | if(is_array($object) || $object instanceof ArrayAccess) |
59 | 59 | { |
60 | 60 | if(array_key_exists($prop, $object)) |
61 | - $object = $object[$prop]; |
|
61 | + $object=$object[$prop]; |
|
62 | 62 | else |
63 | - throw new TInvalidPropertyException('sqlmap_invalid_property',$path); |
|
63 | + throw new TInvalidPropertyException('sqlmap_invalid_property', $path); |
|
64 | 64 | } |
65 | 65 | else if(is_object($object)) |
66 | 66 | { |
67 | - $getter = 'get'.$prop; |
|
67 | + $getter='get'.$prop; |
|
68 | 68 | if(method_exists($object, $getter) && is_callable(array($object, $getter))) |
69 | - $object = $object->{$getter}(); |
|
69 | + $object=$object->{$getter}(); |
|
70 | 70 | else if(in_array($prop, array_keys(get_object_vars($object)))) |
71 | - $object = $object->{$prop}; |
|
71 | + $object=$object->{$prop}; |
|
72 | 72 | elseif(method_exists($object, '__get') && is_callable(array($object, '__get'))) |
73 | - $object = $object->{$prop}; |
|
73 | + $object=$object->{$prop}; |
|
74 | 74 | else |
75 | - throw new TInvalidPropertyException('sqlmap_invalid_property',$path); |
|
75 | + throw new TInvalidPropertyException('sqlmap_invalid_property', $path); |
|
76 | 76 | } |
77 | 77 | else |
78 | - throw new TInvalidPropertyException('sqlmap_invalid_property',$path); |
|
78 | + throw new TInvalidPropertyException('sqlmap_invalid_property', $path); |
|
79 | 79 | } |
80 | 80 | return $object; |
81 | 81 | } |
@@ -89,25 +89,25 @@ discard block |
||
89 | 89 | { |
90 | 90 | if(!is_array($object) && !is_object($object)) |
91 | 91 | return false; |
92 | - $properties = explode('.', $path); |
|
92 | + $properties=explode('.', $path); |
|
93 | 93 | foreach($properties as $prop) |
94 | 94 | { |
95 | 95 | if(is_array($object) || $object instanceof ArrayAccess) |
96 | 96 | { |
97 | 97 | if(array_key_exists($prop, $object)) |
98 | - $object = $object[$prop]; |
|
98 | + $object=$object[$prop]; |
|
99 | 99 | else |
100 | 100 | return false; |
101 | 101 | } |
102 | 102 | else if(is_object($object)) |
103 | 103 | { |
104 | - $getter = 'get'.$prop; |
|
104 | + $getter='get'.$prop; |
|
105 | 105 | if(method_exists($object, $getter) && is_callable(array($object, $getter))) |
106 | - $object = $object->{$getter}(); |
|
106 | + $object=$object->{$getter}(); |
|
107 | 107 | else if(in_array($prop, array_keys(get_object_vars($object)))) |
108 | - $object = $object->{$prop}; |
|
108 | + $object=$object->{$prop}; |
|
109 | 109 | elseif(method_exists($object, '__get') && is_callable(array($object, '__get'))) |
110 | - $object = $object->{$prop}; |
|
110 | + $object=$object->{$prop}; |
|
111 | 111 | else |
112 | 112 | return false; |
113 | 113 | } |
@@ -126,27 +126,27 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public static function set(&$originalObject, $path, $value) |
128 | 128 | { |
129 | - $properties = explode('.', $path); |
|
130 | - $prop = array_pop($properties); |
|
129 | + $properties=explode('.', $path); |
|
130 | + $prop=array_pop($properties); |
|
131 | 131 | if(count($properties) > 0) |
132 | - $object = self::get($originalObject, implode('.',$properties)); |
|
132 | + $object=self::get($originalObject, implode('.', $properties)); |
|
133 | 133 | else |
134 | - $object = &$originalObject; |
|
134 | + $object=&$originalObject; |
|
135 | 135 | |
136 | 136 | if(is_array($object) || $object instanceof ArrayAccess) |
137 | 137 | { |
138 | - $object[$prop] = $value; |
|
138 | + $object[$prop]=$value; |
|
139 | 139 | } |
140 | 140 | else if(is_object($object)) |
141 | 141 | { |
142 | - $setter = 'set'.$prop; |
|
143 | - if (method_exists($object, $setter) && is_callable(array($object, $setter))) |
|
142 | + $setter='set'.$prop; |
|
143 | + if(method_exists($object, $setter) && is_callable(array($object, $setter))) |
|
144 | 144 | $object->{$setter}($value); |
145 | 145 | else |
146 | - $object->{$prop} = $value; |
|
146 | + $object->{$prop}=$value; |
|
147 | 147 | } |
148 | 148 | else |
149 | - throw new TInvalidPropertyException('sqlmap_invalid_property_type',$path); |
|
149 | + throw new TInvalidPropertyException('sqlmap_invalid_property_type', $path); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | } |
@@ -22,14 +22,14 @@ discard block |
||
22 | 22 | array_shift($args); |
23 | 23 | $n=count($args); |
24 | 24 | $tokens=array(); |
25 | - for($i=0;$i<$n;++$i) |
|
25 | + for($i=0; $i < $n; ++$i) |
|
26 | 26 | { |
27 | 27 | if($args[$i] instanceof SimpleXmlElement) |
28 | 28 | $tokens['{'.$i.'}']=$this->implodeNode($args[$i]); |
29 | 29 | else |
30 | 30 | $tokens['{'.$i.'}']=TPropertyValue::ensureString($args[$i]); |
31 | 31 | } |
32 | - parent::__construct(strtr($errorMessage,$tokens)); |
|
32 | + parent::__construct(strtr($errorMessage, $tokens)); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | { |
41 | 41 | $attributes=array(); |
42 | 42 | foreach($node->attributes() as $k=>$v) |
43 | - $attributes[]=$k.'="'.(string)$v.'"'; |
|
44 | - return '<'.$node->getName().' '.implode(' ',$attributes).'>'; |
|
43 | + $attributes[]=$k.'="'.(string) $v.'"'; |
|
44 | + return '<'.$node->getName().' '.implode(' ', $attributes).'>'; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | public function __construct($cacheModel=null) |
28 | 28 | { |
29 | - $this->_cacheModel = $cacheModel; |
|
29 | + $this->_cacheModel=$cacheModel; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | protected function getBaseKeyKeyName() |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | |
37 | 37 | protected function getBaseKey() |
38 | 38 | { |
39 | - $cache = $this->getCache(); |
|
40 | - $keyname = $this->getBaseKeyKeyName(); |
|
41 | - $basekey = $cache->get($keyname); |
|
42 | - if (!$basekey) |
|
39 | + $cache=$this->getCache(); |
|
40 | + $keyname=$this->getBaseKeyKeyName(); |
|
41 | + $basekey=$cache->get($keyname); |
|
42 | + if(!$basekey) |
|
43 | 43 | { |
44 | - $basekey = DxUtil::generateRandomHash(8); |
|
45 | - $cache->set($keyname,$basekey); |
|
44 | + $basekey=DxUtil::generateRandomHash(8); |
|
45 | + $cache->set($keyname, $basekey); |
|
46 | 46 | } |
47 | 47 | return $basekey; |
48 | 48 | } |
@@ -64,23 +64,23 @@ discard block |
||
64 | 64 | |
65 | 65 | public function get($key) |
66 | 66 | { |
67 | - $result = $this->getCache()->get($this->getCacheKey($key)); |
|
68 | - return $result === false ? null : $result; |
|
67 | + $result=$this->getCache()->get($this->getCacheKey($key)); |
|
68 | + return $result===false ? null : $result; |
|
69 | 69 | } |
70 | 70 | |
71 | - public function set($key, $value,$expire=0,$dependency=null) |
|
71 | + public function set($key, $value, $expire=0, $dependency=null) |
|
72 | 72 | { |
73 | - $this->getCache()->set($this->getCacheKey($key), $value, $expire,$dependency); |
|
73 | + $this->getCache()->set($this->getCacheKey($key), $value, $expire, $dependency); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | protected function getCache() |
77 | 77 | { |
78 | - if (!$this->_cache) |
|
79 | - $this->_cache = Prado::getApplication()->getCache(); |
|
78 | + if(!$this->_cache) |
|
79 | + $this->_cache=Prado::getApplication()->getCache(); |
|
80 | 80 | return $this->_cache; |
81 | 81 | } |
82 | 82 | |
83 | - public function add($id,$value,$expire=0,$dependency=null) |
|
83 | + public function add($id, $value, $expire=0, $dependency=null) |
|
84 | 84 | { |
85 | 85 | throw new TSqlMapException('sqlmap_use_set_to_store_cache'); |
86 | 86 | } |
@@ -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 |