@@ -90,7 +90,7 @@ |
||
90 | 90 | * Handle the "edit" and "new" commands by displaying the edit view. |
91 | 91 | * Default command shows the list view. |
92 | 92 | */ |
93 | - public function bubbleEvent($sender,$param) |
|
93 | + public function bubbleEvent($sender, $param) |
|
94 | 94 | { |
95 | 95 | switch(strtolower($param->getCommandName())) |
96 | 96 | { |
@@ -34,7 +34,7 @@ |
||
34 | 34 | * the Active Record class to be displayed/edited/added. |
35 | 35 | * |
36 | 36 | * @author Wei Zhuo <weizhuo[at]gmail[dot]com> |
37 | - * @package Prado\Data\ActiveRecord\Scaffold |
|
37 | + * @package Prado\Data\ActiveRecord\Scaffold |
|
38 | 38 | * @since 3.0 |
39 | 39 | */ |
40 | 40 | class TScaffoldView extends TScaffoldBase |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | case 'char': case 'varchar': |
30 | 30 | return $this->createMultiLineControl($container, $column, $record); |
31 | 31 | default: |
32 | - return $this->createDefaultControl($container,$column, $record); |
|
32 | + return $this->createDefaultControl($container, $column, $record); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | case 'timestamp': |
45 | 45 | return $this->getDateTimeValue($container, $column, $record); |
46 | 46 | default: |
47 | - return $this->getDefaultControlValue($container,$column, $record); |
|
47 | + return $this->getDefaultControlValue($container, $column, $record); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | case 'datetime': case 'smalldatetime': |
27 | 27 | return $this->createDateTimeControl($container, $column, $record); |
28 | 28 | default: |
29 | - $control = $this->createDefaultControl($container,$column, $record); |
|
29 | + $control=$this->createDefaultControl($container, $column, $record); |
|
30 | 30 | if($column->getIsExcluded()) |
31 | 31 | $control->setEnabled(false); |
32 | 32 | return $control; |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | case 'boolean': |
41 | 41 | return $container->findControl(self::DEFAULT_ID)->getChecked(); |
42 | 42 | case 'datetime': case 'smalldatetime': |
43 | - return $this->getDateTimeValue($container,$column, $record); |
|
43 | + return $this->getDateTimeValue($container, $column, $record); |
|
44 | 44 | default: |
45 | - $value = $this->getDefaultControlValue($container,$column, $record); |
|
45 | + $value=$this->getDefaultControlValue($container, $column, $record); |
|
46 | 46 | if(trim($value)==='' && $column->getAllowNull()) |
47 | 47 | return null; |
48 | 48 | else |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | case 'timestamp without time zone': |
31 | 31 | return $this->createDateTimeControl($container, $column, $record); |
32 | 32 | default: |
33 | - return $this->createDefaultControl($container,$column, $record); |
|
33 | + return $this->createDefaultControl($container, $column, $record); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | case 'time without time zone': |
46 | 46 | return $this->getTimeValue($container, $column, $record); |
47 | 47 | case 'timestamp without time zone': |
48 | - return $this->getDateTimeValue($container,$column, $record); |
|
48 | + return $this->getDateTimeValue($container, $column, $record); |
|
49 | 49 | default: |
50 | - return $this->getDefaultControlValue($container,$column, $record); |
|
50 | + return $this->getDefaultControlValue($container, $column, $record); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | { |
14 | 14 | protected function createControl($container, $column, $record) |
15 | 15 | { |
16 | - $dbtype = trim(str_replace(array('unsigned', 'zerofill'),array('','',),strtolower($column->getDbType()))); |
|
16 | + $dbtype=trim(str_replace(array('unsigned', 'zerofill'), array('', '',), strtolower($column->getDbType()))); |
|
17 | 17 | switch($dbtype) |
18 | 18 | { |
19 | 19 | case 'date': |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | protected function getControlValue($container, $column, $record) |
44 | 44 | { |
45 | - $dbtype = trim(str_replace(array('unsigned', 'zerofill'),array('','',),strtolower($column->getDbType()))); |
|
45 | + $dbtype=trim(str_replace(array('unsigned', 'zerofill'), array('', '',), strtolower($column->getDbType()))); |
|
46 | 46 | switch($dbtype) |
47 | 47 | { |
48 | 48 | case 'date': |
@@ -52,15 +52,15 @@ discard block |
||
52 | 52 | case 'time': |
53 | 53 | return $this->getTimeValue($container, $column, $record); |
54 | 54 | case 'datetime': case 'timestamp': |
55 | - return $this->getDateTimeValue($container,$column, $record); |
|
55 | + return $this->getDateTimeValue($container, $column, $record); |
|
56 | 56 | case 'tinyint': |
57 | - return $this->getIntBooleanValue($container,$column, $record); |
|
57 | + return $this->getIntBooleanValue($container, $column, $record); |
|
58 | 58 | case 'set': |
59 | 59 | return $this->getSetValue($container, $column, $record); |
60 | 60 | case 'enum': |
61 | 61 | return $this->getEnumValue($container, $column, $record); |
62 | 62 | default: |
63 | - return $this->getDefaultControlValue($container,$column, $record); |
|
63 | + return $this->getDefaultControlValue($container, $column, $record); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | parent::createIntegerControl($container, $column, $record); |
73 | 73 | } |
74 | 74 | |
75 | - protected function getIntBooleanValue($container,$column, $record) |
|
75 | + protected function getIntBooleanValue($container, $column, $record) |
|
76 | 76 | { |
77 | 77 | if($column->getColumnSize()==1) |
78 | - return (int)$container->findControl(self::DEFAULT_ID)->getChecked(); |
|
78 | + return (int) $container->findControl(self::DEFAULT_ID)->getChecked(); |
|
79 | 79 | else |
80 | - return $this->getDefaultControlValue($container,$column, $record); |
|
80 | + return $this->getDefaultControlValue($container, $column, $record); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | */ |
46 | 46 | protected function getListView() |
47 | 47 | { |
48 | - if($this->_list===null && ($id = $this->getListViewID()) !== null) |
|
48 | + if($this->_list===null && ($id=$this->getListViewID())!==null) |
|
49 | 49 | { |
50 | - $this->_list = $this->getParent()->findControl($id); |
|
51 | - if($this->_list ===null) |
|
50 | + $this->_list=$this->getParent()->findControl($id); |
|
51 | + if($this->_list===null) |
|
52 | 52 | throw new TConfigurationException('scaffold_unable_to_find_list_view', $id); |
53 | 53 | } |
54 | 54 | return $this->_list; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | if(strtolower($param->getCommandName())==='search') |
80 | 80 | { |
81 | - if(($list = $this->getListView()) !== null) |
|
81 | + if(($list=$this->getListView())!==null) |
|
82 | 82 | { |
83 | 83 | $list->setSearchCondition($this->createSearchCondition()); |
84 | 84 | return false; |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | */ |
94 | 94 | protected function createSearchCondition() |
95 | 95 | { |
96 | - $table = $this->getTableInfo(); |
|
96 | + $table=$this->getTableInfo(); |
|
97 | 97 | if(strlen($str=$this->getSearchText()->getText()) > 0) |
98 | 98 | { |
99 | - $builder = $table->createCommandBuilder($this->getRecordFinder()->getDbConnection()); |
|
99 | + $builder=$table->createCommandBuilder($this->getRecordFinder()->getDbConnection()); |
|
100 | 100 | return $builder->getSearchExpression($this->getFields(), $str); |
101 | 101 | } |
102 | 102 | } |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | */ |
107 | 107 | protected function getFields() |
108 | 108 | { |
109 | - if(strlen(trim($str=$this->getSearchableFields()))>0) |
|
110 | - $fields = preg_split('/\s*,\s*/', $str); |
|
109 | + if(strlen(trim($str=$this->getSearchableFields())) > 0) |
|
110 | + $fields=preg_split('/\s*,\s*/', $str); |
|
111 | 111 | else |
112 | - $fields = $this->getTableInfo()->getColumns()->getKeys(); |
|
112 | + $fields=$this->getTableInfo()->getColumns()->getKeys(); |
|
113 | 113 | return $fields; |
114 | 114 | } |
115 | 115 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function getSearchableFields() |
120 | 120 | { |
121 | - return $this->getViewState('SearchableFields',''); |
|
121 | + return $this->getViewState('SearchableFields', ''); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @link https://github.com/pradosoft/prado |
7 | 7 | * @copyright Copyright © 2005-2016 The PRADO Group |
8 | 8 | * @license https://github.com/pradosoft/prado/blob/master/LICENSE |
9 | - * @package Prado\Data\ActiveRecord\Scaffold |
|
9 | + * @package Prado\Data\ActiveRecord\Scaffold |
|
10 | 10 | */ |
11 | 11 | |
12 | 12 | namespace Prado\Data\ActiveRecord\Scaffold; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * are database dependent). |
33 | 33 | * |
34 | 34 | * @author Wei Zhuo <weizhuo[at]gmail[dot]com> |
35 | - * @package Prado\Data\ActiveRecord\Scaffold |
|
35 | + * @package Prado\Data\ActiveRecord\Scaffold |
|
36 | 36 | * @since 3.1 |
37 | 37 | */ |
38 | 38 | class TScaffoldSearch extends TScaffoldBase |
@@ -24,7 +24,7 @@ |
||
24 | 24 | protected function getErrorMessageFile() |
25 | 25 | { |
26 | 26 | $lang=Prado::getPreferredLanguage(); |
27 | - $path = dirname(__FILE__); |
|
27 | + $path=dirname(__FILE__); |
|
28 | 28 | $msgFile=$path.'/messages-'.$lang.'.txt'; |
29 | 29 | if(!is_file($msgFile)) |
30 | 30 | $msgFile=$path.'/messages.txt'; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | public function getTypeHandlers() |
89 | 89 | { |
90 | 90 | if($this->_typeHandlers===null) |
91 | - $this->_typeHandlers= new TSqlMapTypeHandlerRegistry(); |
|
91 | + $this->_typeHandlers=new TSqlMapTypeHandlerRegistry(); |
|
92 | 92 | return $this->_typeHandlers; |
93 | 93 | } |
94 | 94 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function configureXml($file) |
110 | 110 | { |
111 | - $config = new TSqlMapXmlConfiguration($this); |
|
111 | + $config=new TSqlMapXmlConfiguration($this); |
|
112 | 112 | $config->configure($file); |
113 | 113 | } |
114 | 114 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function getCacheDependencies() |
120 | 120 | { |
121 | - if($this->_cacheDependencies === null) |
|
121 | + if($this->_cacheDependencies===null) |
|
122 | 122 | $this->_cacheDependencies=new TChainedCacheDependency(); |
123 | 123 | |
124 | 124 | return $this->_cacheDependencies; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function getMappedStatement($name) |
152 | 152 | { |
153 | - if($this->_mappedStatements->contains($name) == false) |
|
153 | + if($this->_mappedStatements->contains($name)==false) |
|
154 | 154 | throw new TSqlMapUndefinedException('sqlmap_contains_no_statement', $name); |
155 | 155 | return $this->_mappedStatements[$name]; |
156 | 156 | } |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function addMappedStatement(IMappedStatement $statement) |
165 | 165 | { |
166 | - $key = $statement->getID(); |
|
167 | - if($this->_mappedStatements->contains($key) == true) |
|
166 | + $key=$statement->getID(); |
|
167 | + if($this->_mappedStatements->contains($key)==true) |
|
168 | 168 | throw new TSqlMapDuplicateException('sqlmap_already_contains_statement', $key); |
169 | 169 | $this->_mappedStatements->add($key, $statement); |
170 | 170 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function getResultMap($name) |
187 | 187 | { |
188 | - if($this->_resultMaps->contains($name) == false) |
|
188 | + if($this->_resultMaps->contains($name)==false) |
|
189 | 189 | throw new TSqlMapUndefinedException('sqlmap_contains_no_result_map', $name); |
190 | 190 | return $this->_resultMaps[$name]; |
191 | 191 | } |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function addResultMap(TResultMap $result) |
198 | 198 | { |
199 | - $key = $result->getID(); |
|
200 | - if($this->_resultMaps->contains($key) == true) |
|
199 | + $key=$result->getID(); |
|
200 | + if($this->_resultMaps->contains($key)==true) |
|
201 | 201 | throw new TSqlMapDuplicateException('sqlmap_already_contains_result_map', $key); |
202 | 202 | $this->_resultMaps->add($key, $result); |
203 | 203 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function getParameterMap($name) |
219 | 219 | { |
220 | - if($this->_parameterMaps->contains($name) == false) |
|
220 | + if($this->_parameterMaps->contains($name)==false) |
|
221 | 221 | throw new TSqlMapUndefinedException('sqlmap_contains_no_parameter_map', $name); |
222 | 222 | return $this->_parameterMaps[$name]; |
223 | 223 | } |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function addParameterMap(TParameterMap $parameter) |
230 | 230 | { |
231 | - $key = $parameter->getID(); |
|
232 | - if($this->_parameterMaps->contains($key) == true) |
|
231 | + $key=$parameter->getID(); |
|
232 | + if($this->_parameterMaps->contains($key)==true) |
|
233 | 233 | throw new TSqlMapDuplicateException('sqlmap_already_contains_parameter_map', $key); |
234 | 234 | $this->_parameterMaps->add($key, $parameter); |
235 | 235 | } |
@@ -61,6 +61,7 @@ discard block |
||
61 | 61 | * Constructor, create a new SqlMap manager. |
62 | 62 | * @param TDbConnection database connection |
63 | 63 | * @param string configuration file. |
64 | + * @param \Prado\Data\TDbConnection $connection |
|
64 | 65 | */ |
65 | 66 | public function __construct($connection=null) |
66 | 67 | { |
@@ -74,6 +75,7 @@ discard block |
||
74 | 75 | |
75 | 76 | /** |
76 | 77 | * @param TDbConnection default database connection |
78 | + * @param \Prado\Data\TDbConnection $conn |
|
77 | 79 | */ |
78 | 80 | public function setDbConnection($conn) |
79 | 81 | { |
@@ -111,6 +113,7 @@ discard block |
||
111 | 113 | /** |
112 | 114 | * Loads and parses the SqlMap configuration file. |
113 | 115 | * @param string xml configuration file. |
116 | + * @param string $file |
|
114 | 117 | */ |
115 | 118 | public function configureXml($file) |
116 | 119 | { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function queryForObject($statementName, $parameter=null, $result=null) |
69 | 69 | { |
70 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
70 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
71 | 71 | return $statement->executeQueryForObject($this->getDbConnection(), $parameter, $result); |
72 | 72 | } |
73 | 73 | |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function queryForList($statementName, $parameter=null, $result=null, $skip=-1, $max=-1) |
90 | 90 | { |
91 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
92 | - return $statement->executeQueryForList($this->getDbConnection(),$parameter, $result, $skip, $max); |
|
91 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
92 | + return $statement->executeQueryForList($this->getDbConnection(), $parameter, $result, $skip, $max); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function queryWithRowDelegate($statementName, $delegate, $parameter=null, $result=null, $skip=-1, $max=-1) |
111 | 111 | { |
112 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
112 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
113 | 113 | return $statement->executeQueryForList($this->getDbConnection(), $parameter, $result, $skip, $max, $delegate); |
114 | 114 | } |
115 | 115 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function queryForPagedList($statementName, $parameter=null, $pageSize=10, $page=0) |
127 | 127 | { |
128 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
128 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
129 | 129 | return new TSqlMapPagedList($statement, $parameter, $pageSize, null, $page); |
130 | 130 | } |
131 | 131 | |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | * @param integer The number of the page to initially load into the list. |
145 | 145 | * @return TPagedList A PaginatedList of beans containing the rows. |
146 | 146 | */ |
147 | - public function queryForPagedListWithRowDelegate($statementName,$delegate, $parameter=null, $pageSize=10, $page=0) |
|
147 | + public function queryForPagedListWithRowDelegate($statementName, $delegate, $parameter=null, $pageSize=10, $page=0) |
|
148 | 148 | { |
149 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
150 | - return new TSqlMapPagedList($statement, $parameter, $pageSize, $delegate,$page); |
|
149 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
150 | + return new TSqlMapPagedList($statement, $parameter, $pageSize, $delegate, $page); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function queryForMap($statementName, $parameter=null, $keyProperty=null, $valueProperty=null, $skip=-1, $max=-1) |
167 | 167 | { |
168 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
168 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
169 | 169 | return $statement->executeQueryForMap($this->getDbConnection(), $parameter, $keyProperty, $valueProperty, $skip, $max); |
170 | 170 | } |
171 | 171 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function queryForMapWithRowDelegate($statementName, $delegate, $parameter=null, $keyProperty=null, $valueProperty=null, $skip=-1, $max=-1) |
186 | 186 | { |
187 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
187 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
188 | 188 | return $statement->executeQueryForMap($this->getDbConnection(), $parameter, $keyProperty, $valueProperty, $skip, $max, $delegate); |
189 | 189 | } |
190 | 190 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function insert($statementName, $parameter=null) |
208 | 208 | { |
209 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
209 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
210 | 210 | return $statement->executeInsert($this->getDbConnection(), $parameter); |
211 | 211 | } |
212 | 212 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function update($statementName, $parameter=null) |
227 | 227 | { |
228 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
228 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
229 | 229 | return $statement->executeUpdate($this->getDbConnection(), $parameter); |
230 | 230 | } |
231 | 231 |
@@ -36,6 +36,9 @@ discard block |
||
36 | 36 | */ |
37 | 37 | private $_manager; |
38 | 38 | |
39 | + /** |
|
40 | + * @param TSqlMapManager $manager |
|
41 | + */ |
|
39 | 42 | public function __construct($manager) |
40 | 43 | { |
41 | 44 | $this->_manager=$manager; |
@@ -125,7 +128,7 @@ discard block |
||
125 | 128 | * @param mixed The object used to set the parameters in the SQL. |
126 | 129 | * @param integer The maximum number of objects to store in each page. |
127 | 130 | * @param integer The number of the page to initially load into the list. |
128 | - * @return TPagedList A PaginatedList of beans containing the rows. |
|
131 | + * @return TSqlMapPagedList A PaginatedList of beans containing the rows. |
|
129 | 132 | */ |
130 | 133 | public function queryForPagedList($statementName, $parameter=null, $pageSize=10, $page=0) |
131 | 134 | { |
@@ -146,7 +149,7 @@ discard block |
||
146 | 149 | * @param mixed The object used to set the parameters in the SQL. |
147 | 150 | * @param integer The maximum number of objects to store in each page. |
148 | 151 | * @param integer The number of the page to initially load into the list. |
149 | - * @return TPagedList A PaginatedList of beans containing the rows. |
|
152 | + * @return TSqlMapPagedList A PaginatedList of beans containing the rows. |
|
150 | 153 | */ |
151 | 154 | public function queryForPagedListWithRowDelegate($statementName,$delegate, $parameter=null, $pageSize=10, $page=0) |
152 | 155 | { |