@@ -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 | |
@@ -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 | |
@@ -87,8 +87,9 @@ discard block |
||
| 87 | 87 | while (true) { |
| 88 | 88 | $result = strrpos($phrase, "'", $result+1); |
| 89 | 89 | if ($result===false) { |
| 90 | - if ($sentence!='') |
|
| 91 | - $sentence .= ','; |
|
| 90 | + if ($sentence!='') { |
|
| 91 | + $sentence .= ','; |
|
| 92 | + } |
|
| 92 | 93 | $sentence .= $phrase; |
| 93 | 94 | |
| 94 | 95 | if ($is_inside_quotes) { |
@@ -98,15 +99,15 @@ discard block |
||
| 98 | 99 | $sentence = ''; |
| 99 | 100 | break; |
| 100 | 101 | } |
| 101 | - } |
|
| 102 | - else |
|
| 102 | + } else |
|
| 103 | 103 | { |
| 104 | 104 | $valid_result = true; |
| 105 | 105 | if ($result>0 && $phrase{$result-1}=='\\') { |
| 106 | 106 | $valid_result = false; |
| 107 | 107 | } |
| 108 | - if ($valid_result) |
|
| 109 | - $is_inside_quotes = !$is_inside_quotes; |
|
| 108 | + if ($valid_result) { |
|
| 109 | + $is_inside_quotes = !$is_inside_quotes; |
|
| 110 | + } |
|
| 110 | 111 | } |
| 111 | 112 | } |
| 112 | 113 | |
@@ -132,23 +133,27 @@ discard block |
||
| 132 | 133 | // Now, let's split the string using ' |
| 133 | 134 | $work_table = explode("'", $work_str); |
| 134 | 135 | |
| 135 | - if (count($work_table) == 0) |
|
| 136 | - return ''; |
|
| 136 | + if (count($work_table) == 0) { |
|
| 137 | + return ''; |
|
| 138 | + } |
|
| 137 | 139 | |
| 138 | 140 | // if we start with a ', let's remove the first text |
| 139 | - if (strstr($work_str,"'") === 0) |
|
| 140 | - array_shift($work_table); |
|
| 141 | + if (strstr($work_str,"'") === 0) { |
|
| 142 | + array_shift($work_table); |
|
| 143 | + } |
|
| 141 | 144 | |
| 142 | - if (count($work_table) == 0) |
|
| 143 | - return ''; |
|
| 145 | + if (count($work_table) == 0) { |
|
| 146 | + return ''; |
|
| 147 | + } |
|
| 144 | 148 | |
| 145 | 149 | // Now, let's take only the stuff outside the quotes. |
| 146 | 150 | $work_str2 = ''; |
| 147 | 151 | |
| 148 | 152 | $i = 0; |
| 149 | 153 | foreach ($work_table as $str_fragment) { |
| 150 | - if (($i % 2) == 0) |
|
| 151 | - $work_str2 .= $str_fragment.' '; |
|
| 154 | + if (($i % 2) == 0) { |
|
| 155 | + $work_str2 .= $str_fragment.' '; |
|
| 156 | + } |
|
| 152 | 157 | $i++; |
| 153 | 158 | } |
| 154 | 159 | |
@@ -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 | /** |
@@ -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; |
@@ -230,7 +230,7 @@ |
||
| 230 | 230 | $defaultSort = $data['column_name']; |
| 231 | 231 | if (count($matches == 3)){ |
| 232 | 232 | $defaultSortDirection = $matches[2]; |
| 233 | - }else{ |
|
| 233 | + } else{ |
|
| 234 | 234 | $defaultSortDirection = 'ASC'; |
| 235 | 235 | } |
| 236 | 236 | } |
@@ -99,23 +99,27 @@ |
||
| 99 | 99 | // Now, let's split the string using ' |
| 100 | 100 | $work_table = explode("'", $work_str); |
| 101 | 101 | |
| 102 | - if (count($work_table)==0) |
|
| 103 | - return ''; |
|
| 102 | + if (count($work_table)==0) { |
|
| 103 | + return ''; |
|
| 104 | + } |
|
| 104 | 105 | |
| 105 | 106 | // if we start with a ', let's remove the first text |
| 106 | - if (strstr($work_str,"'")===0) |
|
| 107 | - array_shift($work_table); |
|
| 107 | + if (strstr($work_str,"'")===0) { |
|
| 108 | + array_shift($work_table); |
|
| 109 | + } |
|
| 108 | 110 | |
| 109 | - if (count($work_table)==0) |
|
| 110 | - return ''; |
|
| 111 | + if (count($work_table)==0) { |
|
| 112 | + return ''; |
|
| 113 | + } |
|
| 111 | 114 | |
| 112 | 115 | // Now, let's take only the stuff outside the quotes. |
| 113 | 116 | $work_str2 = ''; |
| 114 | 117 | |
| 115 | 118 | $i=0; |
| 116 | 119 | foreach ($work_table as $str_fragment) { |
| 117 | - if (($i % 2) == 0) |
|
| 118 | - $work_str2 .= $str_fragment.' '; |
|
| 120 | + if (($i % 2) == 0) { |
|
| 121 | + $work_str2 .= $str_fragment.' '; |
|
| 122 | + } |
|
| 119 | 123 | $i++; |
| 120 | 124 | } |
| 121 | 125 | |
@@ -50,8 +50,9 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | private static function getAllPossiblePathsRec($sub_table_paths) |
| 52 | 52 | { |
| 53 | - if (count($sub_table_paths)==0) |
|
| 54 | - return array(); |
|
| 53 | + if (count($sub_table_paths)==0) { |
|
| 54 | + return array(); |
|
| 55 | + } |
|
| 55 | 56 | |
| 56 | 57 | $table_path = array_shift($sub_table_paths); |
| 57 | 58 | $possible_sub_paths = AmbiguityException::getAllPossiblePathsRec($sub_table_paths); |
@@ -63,9 +64,9 @@ discard block |
||
| 63 | 64 | { |
| 64 | 65 | $return_table_paths[] = array_merge(array(array('paths'=>array($path))), $possible_sub_path); |
| 65 | 66 | } |
| 67 | + } else { |
|
| 68 | + $return_table_paths[] = array(array('paths'=>array($path))); |
|
| 66 | 69 | } |
| 67 | - else |
|
| 68 | - $return_table_paths[] = array(array('paths'=>array($path))); |
|
| 69 | 70 | } |
| 70 | 71 | return $return_table_paths; |
| 71 | 72 | } |
@@ -31,12 +31,10 @@ discard block |
||
| 31 | 31 | if ($cnt==1) |
| 32 | 32 | { |
| 33 | 33 | return $this[0]->__get($var); |
| 34 | - } |
|
| 35 | - elseif ($cnt>1) |
|
| 34 | + } elseif ($cnt>1) |
|
| 36 | 35 | { |
| 37 | 36 | throw new TDBMException('Array contains many objects! Use getarray_'.$var.' to retrieve an array of '.$var); |
| 38 | - } |
|
| 39 | - else |
|
| 37 | + } else |
|
| 40 | 38 | { |
| 41 | 39 | throw new TDBMException('Array contains no objects'); |
| 42 | 40 | } |
@@ -47,12 +45,10 @@ discard block |
||
| 47 | 45 | if ($cnt==1) |
| 48 | 46 | { |
| 49 | 47 | return $this[0]->__set($var, $value); |
| 50 | - } |
|
| 51 | - elseif ($cnt>1) |
|
| 48 | + } elseif ($cnt>1) |
|
| 52 | 49 | { |
| 53 | 50 | throw new TDBMException('Array contains many objects! Use setarray_'.$var.' to set the array of '.$var); |
| 54 | - } |
|
| 55 | - else |
|
| 51 | + } else |
|
| 56 | 52 | { |
| 57 | 53 | throw new TDBMException('Array contains no objects'); |
| 58 | 54 | } |
@@ -77,8 +73,7 @@ discard block |
||
| 77 | 73 | return $this->setarray($column, $values[0]); |
| 78 | 74 | } elseif (count($this)==1) { |
| 79 | 75 | $this[0]->__call($func_name, $values); |
| 80 | - } |
|
| 81 | - else |
|
| 76 | + } else |
|
| 82 | 77 | { |
| 83 | 78 | throw new TDBMException("Method ".$func_name." not found"); |
| 84 | 79 | } |
@@ -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 | /** |
@@ -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 | /** |