| @@ -122,7 +122,7 @@ | ||
| 122 | 122 | $or = []; | 
| 123 | 123 | |
| 124 | 124 |  		foreach ($condition as $column => $value) { | 
| 125 | -			if($filter->isExactSearch()){ | |
| 125 | +			if ($filter->isExactSearch()) { | |
| 126 | 126 |  				$this->data_source->where("$column = %s", $value); | 
| 127 | 127 | continue; | 
| 128 | 128 | } | 
| @@ -122,7 +122,7 @@ | ||
| 122 | 122 | $or = []; | 
| 123 | 123 | |
| 124 | 124 |  		foreach ($condition as $column => $value) { | 
| 125 | -			if($filter->isExactSearch()){ | |
| 125 | +			if ($filter->isExactSearch()) { | |
| 126 | 126 |  				$this->data_source->where("$column = %s", $value); | 
| 127 | 127 | continue; | 
| 128 | 128 | } | 
| @@ -62,7 +62,7 @@ discard block | ||
| 62 | 62 | |
| 63 | 63 | /** | 
| 64 | 64 | * @return \Doctrine\ORM\Query | 
| 65 | - */ | |
| 65 | + */ | |
| 66 | 66 | public function getQuery() | 
| 67 | 67 |  	{ | 
| 68 | 68 | return $this->data_source->getQuery(); | 
| @@ -240,7 +240,7 @@ discard block | ||
| 240 | 240 |  			foreach ($words as $word) { | 
| 241 | 241 |  				$exprs[] = $this->data_source->expr()->like($c, $this->data_source->expr()->literal("%$word%")); | 
| 242 | 242 | } | 
| 243 | - } | |
| 243 | + } | |
| 244 | 244 | |
| 245 | 245 | $or = call_user_func_array([$this->data_source->expr(), 'orX'], $exprs); | 
| 246 | 246 | |
| @@ -137,7 +137,7 @@ discard block | ||
| 137 | 137 | $value_from = $conditions[$filter->getColumn()]['from']; | 
| 138 | 138 | $value_to = $conditions[$filter->getColumn()]['to']; | 
| 139 | 139 | |
| 140 | -        if ($value_from || $value_from != '') { | |
| 140 | +		if ($value_from || $value_from != '') { | |
| 141 | 141 |  			$this->data_source->where('%n >= ?', $filter->getColumn(), $value_from); | 
| 142 | 142 | } | 
| 143 | 143 | |
| @@ -164,11 +164,11 @@ discard block | ||
| 164 | 164 | continue; | 
| 165 | 165 | } | 
| 166 | 166 | |
| 167 | -            if ($filter->hasSplitWordsSearch() === FALSE) { | |
| 168 | - $words = [$value]; | |
| 169 | -            } else { | |
| 170 | -                $words = explode(' ', $value); | |
| 171 | - } | |
| 167 | +			if ($filter->hasSplitWordsSearch() === FALSE) { | |
| 168 | + $words = [$value]; | |
| 169 | +			} else { | |
| 170 | +				$words = explode(' ', $value); | |
| 171 | + } | |
| 172 | 172 | |
| 173 | 173 |  			foreach ($words as $word) { | 
| 174 | 174 | $escaped = $this->data_source->getConnection()->getDriver()->escapeLike($word, 0); | 
| @@ -122,7 +122,7 @@ | ||
| 122 | 122 | $or = []; | 
| 123 | 123 | |
| 124 | 124 |  		foreach ($condition as $column => $value) { | 
| 125 | -			if($filter->isExactSearch()){ | |
| 125 | +			if ($filter->isExactSearch()) { | |
| 126 | 126 |  				$this->data_source->where("$column = %s", $value); | 
| 127 | 127 | continue; | 
| 128 | 128 | } | 
| @@ -175,17 +175,17 @@ | ||
| 175 | 175 | $like .= "$column = ? OR "; | 
| 176 | 176 | $args[] = "$value"; | 
| 177 | 177 |  			} else { | 
| 178 | -                if ($filter->hasSplitWordsSearch() === FALSE) { | |
| 179 | - $words = [$value]; | |
| 180 | -                } else { | |
| 181 | -                    $words = explode(' ', $value); | |
| 182 | - } | |
| 183 | -                foreach ($words as $word) { | |
| 184 | - $like .= "$column LIKE ? OR "; | |
| 185 | - $args[] = "%$word%"; | |
| 186 | - } | |
| 187 | - } | |
| 188 | - $like = substr($like, 0, strlen($like) - 4) . ')'; | |
| 178 | +				if ($filter->hasSplitWordsSearch() === FALSE) { | |
| 179 | + $words = [$value]; | |
| 180 | +				} else { | |
| 181 | +					$words = explode(' ', $value); | |
| 182 | + } | |
| 183 | +				foreach ($words as $word) { | |
| 184 | + $like .= "$column LIKE ? OR "; | |
| 185 | + $args[] = "%$word%"; | |
| 186 | + } | |
| 187 | + } | |
| 188 | + $like = substr($like, 0, strlen($like) - 4) . ')'; | |
| 189 | 189 | |
| 190 | 190 | $or[] = $like; | 
| 191 | 191 | $big_or .= "$like OR "; | 
| @@ -60,7 +60,7 @@ discard block | ||
| 60 | 60 | } | 
| 61 | 61 | |
| 62 | 62 | return $this->data_source->count( | 
| 63 | - $this->data_source->getName() . '.' . (is_array($primary) ? reset($primary) : $primary) | |
| 63 | + $this->data_source->getName().'.'.(is_array($primary) ? reset($primary) : $primary) | |
| 64 | 64 | ); | 
| 65 | 65 | } | 
| 66 | 66 | |
| @@ -171,8 +171,8 @@ discard block | ||
| 171 | 171 |  			$like = '('; | 
| 172 | 172 | $args = []; | 
| 173 | 173 | |
| 174 | -			if($filter->isExactSearch()){ | |
| 175 | - $like .= "$column = ? OR "; | |
| 174 | +			if ($filter->isExactSearch()) { | |
| 175 | + $like .= "$column = ? OR "; | |
| 176 | 176 | $args[] = "$value"; | 
| 177 | 177 |  			} else { | 
| 178 | 178 |                  if ($filter->hasSplitWordsSearch() === FALSE) { | 
| @@ -185,7 +185,7 @@ discard block | ||
| 185 | 185 | $args[] = "%$word%"; | 
| 186 | 186 | } | 
| 187 | 187 | } | 
| 188 | - $like = substr($like, 0, strlen($like) - 4) . ')'; | |
| 188 | + $like = substr($like, 0, strlen($like) - 4).')'; | |
| 189 | 189 | |
| 190 | 190 | $or[] = $like; | 
| 191 | 191 | $big_or .= "$like OR "; | 
| @@ -223,9 +223,9 @@ discard block | ||
| 223 | 223 | |
| 224 | 224 |  			foreach ($values as $value) { | 
| 225 | 225 |  				if ($i == $length) { | 
| 226 | - $or .= $filter->getColumn() . ' = ?)'; | |
| 226 | + $or .= $filter->getColumn().' = ?)'; | |
| 227 | 227 |  				} else { | 
| 228 | - $or .= $filter->getColumn() . ' = ? OR '; | |
| 228 | + $or .= $filter->getColumn().' = ? OR '; | |
| 229 | 229 | } | 
| 230 | 230 | |
| 231 | 231 | $i++; | 
| @@ -235,7 +235,7 @@ discard block | ||
| 235 | 235 | |
| 236 | 236 | call_user_func_array([$this->data_source, 'where'], $values); | 
| 237 | 237 |  		} else { | 
| 238 | - $this->data_source->where($filter->getColumn() . ' = ?', reset($values)); | |
| 238 | + $this->data_source->where($filter->getColumn().' = ?', reset($values)); | |
| 239 | 239 | } | 
| 240 | 240 | } | 
| 241 | 241 | |
| @@ -180,12 +180,12 @@ discard block | ||
| 180 | 180 | |
| 181 | 181 |  		foreach ($condition as $column => $value) { | 
| 182 | 182 | |
| 183 | -            if($filter->isExactSearch()){ | |
| 184 | - $expr .= "%column = %s OR "; | |
| 185 | - $params[] = $column; | |
| 186 | - $params[] = "$value"; | |
| 187 | - continue; | |
| 188 | - } | |
| 183 | +			if($filter->isExactSearch()){ | |
| 184 | + $expr .= "%column = %s OR "; | |
| 185 | + $params[] = $column; | |
| 186 | + $params[] = "$value"; | |
| 187 | + continue; | |
| 188 | + } | |
| 189 | 189 | |
| 190 | 190 |  			if ($filter->hasSplitWordsSearch() === FALSE) { | 
| 191 | 191 | $words = [$value]; | 
| @@ -295,12 +295,12 @@ discard block | ||
| 295 | 295 | return $this; | 
| 296 | 296 | } | 
| 297 | 297 | |
| 298 | - /** | |
| 299 | - * Adjust column from DataGrid 'foreignKey.column' to Nextras 'this->foreignKey->column' | |
| 300 | - * @param string $column | |
| 301 | - * @return string | |
| 302 | - */ | |
| 303 | -        private function prepareColumn($column) { | |
| 298 | + /** | |
| 299 | + * Adjust column from DataGrid 'foreignKey.column' to Nextras 'this->foreignKey->column' | |
| 300 | + * @param string $column | |
| 301 | + * @return string | |
| 302 | + */ | |
| 303 | +		private function prepareColumn($column) { | |
| 304 | 304 |  		if (Strings::contains($column, '.')) { | 
| 305 | 305 |  			return 'this->' . str_replace('.', '->', $column); | 
| 306 | 306 | } | 
| @@ -101,8 +101,8 @@ discard block | ||
| 101 | 101 | $date_end = clone $date; | 
| 102 | 102 | |
| 103 | 103 | $this->data_source = $this->data_source->findBy([ | 
| 104 | - $this->prepareColumn($column) . '>=' => $date->setTime(0, 0, 0), | |
| 105 | - $this->prepareColumn($column) . '<=' => $date_end->setTime(23, 59, 59) | |
| 104 | + $this->prepareColumn($column).'>=' => $date->setTime(0, 0, 0), | |
| 105 | + $this->prepareColumn($column).'<=' => $date_end->setTime(23, 59, 59) | |
| 106 | 106 | ]); | 
| 107 | 107 | } | 
| 108 | 108 | |
| @@ -125,12 +125,12 @@ discard block | ||
| 125 | 125 | $dataCondition = []; | 
| 126 | 126 |  		if ($value_from) { | 
| 127 | 127 | $date_from = \DateTime::createFromFormat($filter->getPhpFormat(), $value_from); | 
| 128 | - $dataCondition[$this->prepareColumn($filter->getColumn()) . '>='] = $date_from->setTime(0, 0, 0); | |
| 128 | + $dataCondition[$this->prepareColumn($filter->getColumn()).'>='] = $date_from->setTime(0, 0, 0); | |
| 129 | 129 | } | 
| 130 | 130 | |
| 131 | 131 |  		if ($value_to) { | 
| 132 | 132 | $date_to = \DateTime::createFromFormat($filter->getPhpFormat(), $value_to); | 
| 133 | - $dataCondition[$this->prepareColumn($filter->getColumn()) . '<='] = $date_to->setTime(23, 59, 59); | |
| 133 | + $dataCondition[$this->prepareColumn($filter->getColumn()).'<='] = $date_to->setTime(23, 59, 59); | |
| 134 | 134 | } | 
| 135 | 135 | |
| 136 | 136 |  		if (!empty($dataCondition)) { | 
| @@ -154,11 +154,11 @@ discard block | ||
| 154 | 154 | $dataCondition = []; | 
| 155 | 155 | |
| 156 | 156 |  		if ($value_from) { | 
| 157 | - $dataCondition[$this->prepareColumn($filter->getColumn()) . '>='] = $value_from; | |
| 157 | + $dataCondition[$this->prepareColumn($filter->getColumn()).'>='] = $value_from; | |
| 158 | 158 | } | 
| 159 | 159 | |
| 160 | 160 |  		if ($value_to) { | 
| 161 | - $dataCondition[$this->prepareColumn($filter->getColumn()) . '<='] = $value_to; | |
| 161 | + $dataCondition[$this->prepareColumn($filter->getColumn()).'<='] = $value_to; | |
| 162 | 162 | } | 
| 163 | 163 | |
| 164 | 164 |  		if (!empty($dataCondition)) { | 
| @@ -180,7 +180,7 @@ discard block | ||
| 180 | 180 | |
| 181 | 181 |  		foreach ($condition as $column => $value) { | 
| 182 | 182 | |
| 183 | -            if($filter->isExactSearch()){ | |
| 183 | +            if ($filter->isExactSearch()) { | |
| 184 | 184 | $expr .= "%column = %s OR "; | 
| 185 | 185 | $params[] = $column; | 
| 186 | 186 | $params[] = "$value"; | 
| @@ -302,7 +302,7 @@ discard block | ||
| 302 | 302 | */ | 
| 303 | 303 |          private function prepareColumn($column) { | 
| 304 | 304 |  		if (Strings::contains($column, '.')) { | 
| 305 | -			return 'this->' . str_replace('.', '->', $column); | |
| 305 | +			return 'this->'.str_replace('.', '->', $column); | |
| 306 | 306 | } | 
| 307 | 307 | return $column; | 
| 308 | 308 | } | 
| @@ -173,7 +173,7 @@ | ||
| 173 | 173 | $exprs = []; | 
| 174 | 174 | |
| 175 | 175 |  		foreach ($filter->getCondition() as $column => $value) { | 
| 176 | -			if($filter->isExactSearch()) { | |
| 176 | +			if ($filter->isExactSearch()) { | |
| 177 | 177 | Criteria::expr()->eq($column, $value); | 
| 178 | 178 | continue; | 
| 179 | 179 | } | 
| @@ -152,10 +152,10 @@ | ||
| 152 | 152 | |
| 153 | 153 |  			foreach ($condition as $column => $value) { | 
| 154 | 154 |  				if ($filter instanceof FilterText && $filter->isExactSearch()) { | 
| 155 | - return $row[$column] == $value; | |
| 156 | - } | |
| 155 | + return $row[$column] == $value; | |
| 156 | + } | |
| 157 | 157 | |
| 158 | -                if ($filter instanceof FilterText && $filter->hasSplitWordsSearch() === FALSE) { | |
| 158 | +				if ($filter instanceof FilterText && $filter->hasSplitWordsSearch() === FALSE) { | |
| 159 | 159 | $words = [$value]; | 
| 160 | 160 |  				} else { | 
| 161 | 161 |  					$words = explode(' ', $value); |