@@ -2,12 +2,8 @@ |
||
| 2 | 2 | namespace Mouf\Database\TDBM\Controllers; |
| 3 | 3 | |
| 4 | 4 | use Mouf\Composer\ClassNameMapper; |
| 5 | -use Mouf\MoufUtils; |
|
| 6 | - |
|
| 7 | 5 | use Mouf\Actions\InstallUtils; |
| 8 | - |
|
| 9 | 6 | use Mouf\MoufManager; |
| 10 | - |
|
| 11 | 7 | use Mouf\Html\HtmlElement\HtmlBlock; |
| 12 | 8 | use Mouf\Mvc\Splash\Controllers\Controller; |
| 13 | 9 | |
@@ -144,7 +144,7 @@ |
||
| 144 | 144 | * @param string $selfedit |
| 145 | 145 | * @throws \Mouf\MoufException |
| 146 | 146 | */ |
| 147 | - public function generate($daonamespace, $beannamespace, $storeInUtc = 0, $selfedit="false") { |
|
| 147 | + public function generate($daonamespace, $beannamespace, $storeInUtc = 0, $selfedit = "false") { |
|
| 148 | 148 | $this->selfedit = $selfedit; |
| 149 | 149 | |
| 150 | 150 | if ($selfedit == "true") { |
@@ -1,8 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Mouf\Database\TDBM\Filters; |
| 3 | 3 | |
| 4 | -use Doctrine\DBAL\Driver\Connection; |
|
| 5 | - |
|
| 6 | 4 | /* |
| 7 | 5 | Copyright (C) 2006-2011 David Négrier - THE CODING MACHINE |
| 8 | 6 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @param string $sqlString |
| 62 | 62 | */ |
| 63 | - public function __construct($sqlString=null) { |
|
| 63 | + public function __construct($sqlString = null) { |
|
| 64 | 64 | $this->sqlString = $sqlString; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | $result = -1; |
| 87 | 87 | while (true) { |
| 88 | 88 | $result = strrpos($phrase, "'", $result+1); |
| 89 | - if ($result===false) { |
|
| 90 | - if ($sentence!='') |
|
| 89 | + if ($result === false) { |
|
| 90 | + if ($sentence != '') |
|
| 91 | 91 | $sentence .= ','; |
| 92 | 92 | $sentence .= $phrase; |
| 93 | 93 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | else |
| 103 | 103 | { |
| 104 | 104 | $valid_result = true; |
| 105 | - if ($result>0 && $phrase{$result-1}=='\\') { |
|
| 105 | + if ($result>0 && $phrase{$result-1} == '\\') { |
|
| 106 | 106 | $valid_result = false; |
| 107 | 107 | } |
| 108 | 108 | if ($valid_result) |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | // First, let's remove all the stuff in quotes: |
| 129 | 129 | |
| 130 | 130 | // Let's remove all the \' found |
| 131 | - $work_str = str_replace("\\'",'',$this->sqlString); |
|
| 131 | + $work_str = str_replace("\\'", '', $this->sqlString); |
|
| 132 | 132 | // Now, let's split the string using ' |
| 133 | 133 | $work_table = explode("'", $work_str); |
| 134 | 134 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | return ''; |
| 137 | 137 | |
| 138 | 138 | // if we start with a ', let's remove the first text |
| 139 | - if (strstr($work_str,"'") === 0) |
|
| 139 | + if (strstr($work_str, "'") === 0) |
|
| 140 | 140 | array_shift($work_table); |
| 141 | 141 | |
| 142 | 142 | if (count($work_table) == 0) |
@@ -147,13 +147,13 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | $i = 0; |
| 149 | 149 | foreach ($work_table as $str_fragment) { |
| 150 | - if (($i % 2) == 0) |
|
| 150 | + if (($i%2) == 0) |
|
| 151 | 151 | $work_str2 .= $str_fragment.' '; |
| 152 | 152 | $i++; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | // Now, let's run a regexp to find all the strings matching the pattern xxx.yyy |
| 156 | - preg_match_all('/([a-zA-Z_](?:[a-zA-Z0-9_]*))\.(?:[a-zA-Z_](?:[a-zA-Z0-9_]*))/', $work_str2,$capture_result); |
|
| 156 | + preg_match_all('/([a-zA-Z_](?:[a-zA-Z0-9_]*))\.(?:[a-zA-Z_](?:[a-zA-Z0-9_]*))/', $work_str2, $capture_result); |
|
| 157 | 157 | |
| 158 | 158 | $tables_used = $capture_result[1]; |
| 159 | 159 | // remove doubles: |
@@ -18,7 +18,6 @@ |
||
| 18 | 18 | along with this program; if not, write to the Free Software |
| 19 | 19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | 20 | */ |
| 21 | -use Doctrine\DBAL\Driver\Connection; |
|
| 22 | 21 | |
| 23 | 22 | |
| 24 | 23 | /** |
@@ -108,7 +108,7 @@ |
||
| 108 | 108 | public function rewind() |
| 109 | 109 | { |
| 110 | 110 | $this->_dbLoadIfNotLoaded(); |
| 111 | - if (count($this->dbRow) > 0) { |
|
| 111 | + if (count($this->dbRow)>0) { |
|
| 112 | 112 | $this->_validIterator = true; |
| 113 | 113 | } else { |
| 114 | 114 | $this->_validIterator = false; |
@@ -2,8 +2,6 @@ |
||
| 2 | 2 | namespace Mouf\Database\TDBM\Utils; |
| 3 | 3 | |
| 4 | 4 | use Doctrine\DBAL\Driver\Connection; |
| 5 | -use Doctrine\DBAL\Schema\Column; |
|
| 6 | -use Doctrine\DBAL\Schema\ForeignKeyConstraint; |
|
| 7 | 5 | use Doctrine\DBAL\Schema\Schema; |
| 8 | 6 | use Doctrine\DBAL\Schema\Table; |
| 9 | 7 | use Doctrine\DBAL\Types\Type; |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | }"; |
| 208 | 208 | $this->ensureDirectoryExist($possibleFileName); |
| 209 | - file_put_contents($possibleFileName ,$str); |
|
| 209 | + file_put_contents($possibleFileName, $str); |
|
| 210 | 210 | @chmod($possibleFileName, 0664); |
| 211 | 211 | } |
| 212 | 212 | } |
@@ -226,11 +226,11 @@ discard block |
||
| 226 | 226 | foreach ($table->getColumns() as $column) { |
| 227 | 227 | $comments = $column->getComment(); |
| 228 | 228 | $matches = array(); |
| 229 | - if (preg_match('/@defaultSort(\((desc|asc)\))*/', $comments, $matches) != 0){ |
|
| 229 | + if (preg_match('/@defaultSort(\((desc|asc)\))*/', $comments, $matches) != 0) { |
|
| 230 | 230 | $defaultSort = $data['column_name']; |
| 231 | - if (count($matches == 3)){ |
|
| 231 | + if (count($matches == 3)) { |
|
| 232 | 232 | $defaultSortDirection = $matches[2]; |
| 233 | - }else{ |
|
| 233 | + } else { |
|
| 234 | 234 | $defaultSortDirection = 'ASC'; |
| 235 | 235 | } |
| 236 | 236 | } |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | $possibleBaseFileName = $this->rootPath.$possibleBaseFileNames[0]; |
| 417 | 417 | |
| 418 | 418 | $this->ensureDirectoryExist($possibleBaseFileName); |
| 419 | - file_put_contents($possibleBaseFileName ,$str); |
|
| 419 | + file_put_contents($possibleBaseFileName, $str); |
|
| 420 | 420 | @chmod($possibleBaseFileName, 0664); |
| 421 | 421 | |
| 422 | 422 | $possibleFileNames = $classNameMapper->getPossibleFileNames($daonamespace."\\".$className); |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | } |
| 448 | 448 | "; |
| 449 | 449 | $this->ensureDirectoryExist($possibleFileName); |
| 450 | - file_put_contents($possibleFileName ,$str); |
|
| 450 | + file_put_contents($possibleFileName, $str); |
|
| 451 | 451 | @chmod($possibleFileName, 0664); |
| 452 | 452 | } |
| 453 | 453 | } |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | $possibleFileName = $this->rootPath.$possibleFileNames[0]; |
| 524 | 524 | |
| 525 | 525 | $this->ensureDirectoryExist($possibleFileName); |
| 526 | - file_put_contents($possibleFileName ,$str); |
|
| 526 | + file_put_contents($possibleFileName, $str); |
|
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | /** |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | * @return string |
| 535 | 535 | */ |
| 536 | 536 | public static function toCamelCase($str) { |
| 537 | - $str = strtoupper(substr($str,0,1)).substr($str,1); |
|
| 537 | + $str = strtoupper(substr($str, 0, 1)).substr($str, 1); |
|
| 538 | 538 | while (true) { |
| 539 | 539 | if (strpos($str, "_") === false && strpos($str, " ") === false) { |
| 540 | 540 | break; |
@@ -544,9 +544,9 @@ discard block |
||
| 544 | 544 | if ($pos === false) { |
| 545 | 545 | $pos = strpos($str, " "); |
| 546 | 546 | } |
| 547 | - $before = substr($str,0,$pos); |
|
| 548 | - $after = substr($str,$pos+1); |
|
| 549 | - $str = $before.strtoupper(substr($after,0,1)).substr($after,1); |
|
| 547 | + $before = substr($str, 0, $pos); |
|
| 548 | + $after = substr($str, $pos+1); |
|
| 549 | + $str = $before.strtoupper(substr($after, 0, 1)).substr($after, 1); |
|
| 550 | 550 | } |
| 551 | 551 | return $str; |
| 552 | 552 | } |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | Type::GUID => 'string' |
| 628 | 628 | ]; |
| 629 | 629 | |
| 630 | - return isset($map[$type->getName()])?$map[$type->getName()]:$type->getName(); |
|
| 630 | + return isset($map[$type->getName()]) ? $map[$type->getName()] : $type->getName(); |
|
| 631 | 631 | } |
| 632 | 632 | |
| 633 | 633 | /** |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | |
| 643 | 643 | foreach ($tables as $table) { |
| 644 | 644 | $tableName = $table->getName(); |
| 645 | - $tableToBeanMap[$tableName] = $beanNamespace . "\\" . self::getBeanNameFromTableName($tableName); |
|
| 645 | + $tableToBeanMap[$tableName] = $beanNamespace."\\".self::getBeanNameFromTableName($tableName); |
|
| 646 | 646 | } |
| 647 | 647 | return $tableToBeanMap; |
| 648 | 648 | } |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | <div class="control-group"> |
| 30 | 30 | <label class="control-label">Store dates / timestamps in UTC:</label> |
| 31 | 31 | <div class="controls"> |
| 32 | - <input type="checkbox" name="storeInUtc" value="1" <?php echo $this->storeInUtc?'checked="checked"':"" ?>></input> |
|
| 32 | + <input type="checkbox" name="storeInUtc" value="1" <?php echo $this->storeInUtc ? 'checked="checked"' : "" ?>></input> |
|
| 33 | 33 | <span class="help-block">Select this option if you want timestamps to be stored in UTC. |
| 34 | 34 | If your application supports several time zones, you should select this option to store all dates in |
| 35 | 35 | the same time zone.</span> |
@@ -112,7 +112,7 @@ |
||
| 112 | 112 | */ |
| 113 | 113 | public function getCurrentPage() |
| 114 | 114 | { |
| 115 | - return floor($this->offset / $this->limit) + 1; |
|
| 115 | + return floor($this->offset/$this->limit)+1; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -18,7 +18,6 @@ |
||
| 18 | 18 | along with this program; if not, write to the Free Software |
| 19 | 19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | 20 | */ |
| 21 | -use Doctrine\DBAL\Driver\Connection; |
|
| 22 | 21 | |
| 23 | 22 | |
| 24 | 23 | /** |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @param string $columnName |
| 86 | 86 | * @param array<string> $values |
| 87 | 87 | */ |
| 88 | - public function __construct($tableName=null, $columnName=null, $values=array()) { |
|
| 88 | + public function __construct($tableName = null, $columnName = null, $values = array()) { |
|
| 89 | 89 | $this->tableName = $tableName; |
| 90 | 90 | $this->columnName = $columnName; |
| 91 | 91 | $this->values = $values; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - return $this->tableName.'.'.$this->columnName.' IN ('.implode(',',$values_sql).")"; |
|
| 120 | + return $this->tableName.'.'.$this->columnName.' IN ('.implode(',', $values_sql).")"; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | * @param string $columnName |
| 87 | 87 | * @param string $order |
| 88 | 88 | */ |
| 89 | - public function __construct($tableName=null, $columnName=null, $order=null) { |
|
| 89 | + public function __construct($tableName = null, $columnName = null, $order = null) { |
|
| 90 | 90 | $this->tableName = $tableName; |
| 91 | 91 | $this->columnName = $columnName; |
| 92 | 92 | $this->order = $order; |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | * |
| 60 | 60 | * @param FilterInterface $filter |
| 61 | 61 | */ |
| 62 | - public function __construct($filter=null) { |
|
| 62 | + public function __construct($filter = null) { |
|
| 63 | 63 | $this->filter = $filter; |
| 64 | 64 | } |
| 65 | 65 | |