@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @param array<FilterInterface> $filter |
| 61 | 61 | */ |
| 62 | - public function __construct($filters=null) { |
|
| 62 | + public function __construct($filters = null) { |
|
| 63 | 63 | $this->filters = $filters; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | if (count($filters_sql)>0) { |
| 93 | - return '('.implode(' OR ',$filters_sql).')'; |
|
| 93 | + return '('.implode(' OR ', $filters_sql).')'; |
|
| 94 | 94 | } else { |
| 95 | 95 | return ''; |
| 96 | 96 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | $tables = array(); |
| 109 | 109 | foreach ($this->filters as $filter) { |
| 110 | - $tables = array_merge($tables,$filter->getUsedTables()); |
|
| 110 | + $tables = array_merge($tables, $filter->getUsedTables()); |
|
| 111 | 111 | } |
| 112 | 112 | // Remove tables in double. |
| 113 | 113 | $tables = array_flip(array_flip($tables)); |
@@ -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 | |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | $result = -1; |
| 89 | 89 | while (true) { |
| 90 | 90 | $result = strrpos($phrase, "'", $result+1); |
| 91 | - if ($result===false) { |
|
| 92 | - if ($sentence!='') |
|
| 91 | + if ($result === false) { |
|
| 92 | + if ($sentence != '') |
|
| 93 | 93 | $sentence .= ','; |
| 94 | 94 | $sentence .= $phrase; |
| 95 | 95 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | { |
| 106 | 106 | $valid_result = true; |
| 107 | 107 | //echo '-'.$phrase{$result-1}.'-'; |
| 108 | - if ($result>0 && $phrase{$result-1}=='\\') { |
|
| 108 | + if ($result>0 && $phrase{$result-1} == '\\') { |
|
| 109 | 109 | $valid_result = false; |
| 110 | 110 | } |
| 111 | 111 | if ($valid_result) |
@@ -133,33 +133,33 @@ discard block |
||
| 133 | 133 | // First, let's remove all the stuff in quotes: |
| 134 | 134 | |
| 135 | 135 | // Let's remove all the \' found |
| 136 | - $work_str = str_replace("\\'",'',$this->sqlString); |
|
| 136 | + $work_str = str_replace("\\'", '', $this->sqlString); |
|
| 137 | 137 | // Now, let's split the string using ' |
| 138 | 138 | $work_table = explode("'", $work_str); |
| 139 | 139 | |
| 140 | - if (count($work_table)==0) |
|
| 140 | + if (count($work_table) == 0) |
|
| 141 | 141 | return ''; |
| 142 | 142 | |
| 143 | 143 | // if we start with a ', let's remove the first text |
| 144 | - if (strstr($work_str,"'")===0) |
|
| 144 | + if (strstr($work_str, "'") === 0) |
|
| 145 | 145 | array_shift($work_table); |
| 146 | 146 | |
| 147 | - if (count($work_table)==0) |
|
| 147 | + if (count($work_table) == 0) |
|
| 148 | 148 | return ''; |
| 149 | 149 | |
| 150 | 150 | // Now, let's take only the stuff outside the quotes. |
| 151 | 151 | $work_str2 = ''; |
| 152 | 152 | |
| 153 | - $i=0; |
|
| 153 | + $i = 0; |
|
| 154 | 154 | foreach ($work_table as $str_fragment) { |
| 155 | - if (($i % 2) == 0) |
|
| 155 | + if (($i%2) == 0) |
|
| 156 | 156 | $work_str2 .= $str_fragment.' '; |
| 157 | 157 | $i++; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | // Now, let's run a regexp to find all the strings matching the pattern xxx.yyy |
| 161 | 161 | //preg_match_all('/(\w+)\.(?:\w+)/', $work_str2,$capture_result); |
| 162 | - preg_match_all('/([a-zA-Z_](?:[a-zA-Z0-9_]*))\.(?:[a-zA-Z_](?:[a-zA-Z0-9_]*))/', $work_str2,$capture_result); |
|
| 162 | + preg_match_all('/([a-zA-Z_](?:[a-zA-Z0-9_]*))\.(?:[a-zA-Z_](?:[a-zA-Z0-9_]*))/', $work_str2, $capture_result); |
|
| 163 | 163 | |
| 164 | 164 | $tables_used = $capture_result[1]; |
| 165 | 165 | // remove doubles: |
@@ -139,7 +139,7 @@ |
||
| 139 | 139 | * @param string $name |
| 140 | 140 | * @param bool $selfedit |
| 141 | 141 | */ |
| 142 | - public function generate($sourcedirectory, $daonamespace, $beannamespace, $keepSupport = 0, $storeInUtc = 0, $selfedit="false") { |
|
| 142 | + public function generate($sourcedirectory, $daonamespace, $beannamespace, $keepSupport = 0, $storeInUtc = 0, $selfedit = "false") { |
|
| 143 | 143 | $this->selfedit = $selfedit; |
| 144 | 144 | |
| 145 | 145 | if ($selfedit == "true") { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @Action |
| 44 | 44 | * //@Admin |
| 45 | 45 | */ |
| 46 | - public function defaultAction($name, $selfedit="false") { |
|
| 46 | + public function defaultAction($name, $selfedit = "false") { |
|
| 47 | 47 | $this->initController($name, $selfedit); |
| 48 | 48 | |
| 49 | 49 | // Fill variables |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * @param string $name |
| 95 | 95 | * @param bool $selfedit |
| 96 | 96 | */ |
| 97 | - public function generate($name, $sourcedirectory, $daonamespace, $beannamespace, $daofactoryclassname, $daofactoryinstancename, $keepSupport = 0, $storeInUtc = 0,$selfedit="false") { |
|
| 97 | + public function generate($name, $sourcedirectory, $daonamespace, $beannamespace, $daofactoryclassname, $daofactoryinstancename, $keepSupport = 0, $storeInUtc = 0, $selfedit = "false") { |
|
| 98 | 98 | $this->initController($name, $selfedit); |
| 99 | 99 | |
| 100 | 100 | self::generateDaos($this->moufManager, $name, $sourcedirectory, $daonamespace, $beannamespace, $daofactoryclassname, $daofactoryinstancename, $selfedit, $keepSupport, $storeInUtc); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * This function generates the DAOs and Beans for the TDBM service passed in parameter. |
| 108 | 108 | * |
| 109 | 109 | */ |
| 110 | - public static function generateDaos(MoufManager $moufManager, $name, $sourcedirectory, $daonamespace, $beannamespace, $daofactoryclassname, $daofactoryinstancename, $selfedit="false", $keepSupport = null, $storeInUtc = null) { |
|
| 110 | + public static function generateDaos(MoufManager $moufManager, $name, $sourcedirectory, $daonamespace, $beannamespace, $daofactoryclassname, $daofactoryinstancename, $selfedit = "false", $keepSupport = null, $storeInUtc = null) { |
|
| 111 | 111 | $moufManager->setVariable("tdbmDefaultSourceDirectory_".$name, $sourcedirectory); |
| 112 | 112 | $moufManager->setVariable("tdbmDefaultDaoNamespace_".$name, $daonamespace); |
| 113 | 113 | $moufManager->setVariable("tdbmDefaultBeanNamespace_".$name, $beannamespace); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | <div class="control-group"> |
| 53 | 53 | <label class="control-label">Keep support for previous DAOs:</label> |
| 54 | 54 | <div class="controls"> |
| 55 | - <input type="checkbox" name="keepSupport" <?php echo $this->keepSupport?'checked="checked"':"" ?>></input> |
|
| 55 | + <input type="checkbox" name="keepSupport" <?php echo $this->keepSupport ? 'checked="checked"' : "" ?>></input> |
|
| 56 | 56 | <span class="help-block">DAOs generated before TDBM 2.3 had a different method signature. This will ensure this signature |
| 57 | 57 | is respected. Use this only if you are migrating legacy code.</span> |
| 58 | 58 | </div> |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | <div class="control-group"> |
| 62 | 62 | <label class="control-label">Store dates / timestamps in UTC:</label> |
| 63 | 63 | <div class="controls"> |
| 64 | - <input type="checkbox" name="storeInUtc" value="1" <?php echo $this->storeInUtc?'checked="checked"':"" ?>></input> |
|
| 64 | + <input type="checkbox" name="storeInUtc" value="1" <?php echo $this->storeInUtc ? 'checked="checked"' : "" ?>></input> |
|
| 65 | 65 | <span class="help-block">Select this option if you want timestamps to be stored in UTC. |
| 66 | 66 | If your application supports several time zones, you should select this option to store all dates in |
| 67 | 67 | the same time zone.</span> |