@@ -204,6 +204,10 @@ |
||
| 204 | 204 | return $return; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | + /** |
|
| 208 | + * @param integer $level |
|
| 209 | + * @param string $opr |
|
| 210 | + */ |
|
| 207 | 211 | private function parseRightExpression($level, $opr) |
| 208 | 212 | { |
| 209 | 213 | switch ($opr) { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $this->getToken(); |
| 62 | 62 | $expression = $this->parseExpression(); |
| 63 | 63 | if ($this->token !== false) { |
| 64 | - throw new FilterCompilerException("Unexpected '" . $this->token . "' in filter [$filter]"); |
|
| 64 | + throw new FilterCompilerException("Unexpected '".$this->token."' in filter [$filter]"); |
|
| 65 | 65 | } |
| 66 | 66 | $parsed = $this->renderExpression($expression); |
| 67 | 67 | return $parsed; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | private function renderExpression($expression) |
| 71 | 71 | { |
| 72 | 72 | if (is_array($expression)) { |
| 73 | - $expression = $this->renderExpression($expression['left']) . " {$expression['opr']} " . $this->renderExpression($expression['right']); |
|
| 73 | + $expression = $this->renderExpression($expression['left'])." {$expression['opr']} ".$this->renderExpression($expression['right']); |
|
| 74 | 74 | } |
| 75 | 75 | return $expression; |
| 76 | 76 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $tokens = [$tokens]; |
| 82 | 82 | } |
| 83 | 83 | if (array_search($this->lookahead, $tokens) === false) { |
| 84 | - throw new FilterCompilerException("Expected " . implode(' or ', $tokens) . " but found " . $this->lookahead); |
|
| 84 | + throw new FilterCompilerException("Expected ".implode(' or ', $tokens)." but found ".$this->lookahead); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | private function returnPositionTag() |
| 175 | 175 | { |
| 176 | - return ":filter_bind_" . (++$this->numPositions); |
|
| 176 | + return ":filter_bind_".(++$this->numPositions); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | private function parseObracket() |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | if ($this->token === false && strlen($this->filter) > 0) { |
| 261 | - throw new FilterCompilerException("Unexpected character [" . $this->filter[0] . "] begining " . $this->filter . "."); |
|
| 261 | + throw new FilterCompilerException("Unexpected character [".$this->filter[0]."] begining ".$this->filter."."); |
|
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | $rewritten = []; |
| 275 | 275 | foreach ($data as $key => $value) { |
| 276 | 276 | if (is_numeric($key)) { |
| 277 | - $rewritten["filter_bind_" . ($key + 1)] = $value; |
|
| 277 | + $rewritten["filter_bind_".($key + 1)] = $value; |
|
| 278 | 278 | } else { |
| 279 | 279 | $rewritten[$key] = $value; |
| 280 | 280 | } |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | { |
| 6 | 6 | public function mapDataTypes($nativeType) |
| 7 | 7 | { |
| 8 | - switch($nativeType) |
|
| 8 | + switch ($nativeType) |
|
| 9 | 9 | { |
| 10 | 10 | case 'int': |
| 11 | 11 | return 'integer'; |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function mapDataTypes($nativeType) |
| 14 | 14 | { |
| 15 | - switch($nativeType) |
|
| 15 | + switch ($nativeType) |
|
| 16 | 16 | { |
| 17 | 17 | case 'character varying': |
| 18 | 18 | return 'string'; |
@@ -70,11 +70,11 @@ |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | if (!isset($this->options['junction_local_key'])) { |
| 73 | - $this->options['junction_local_key'] = Text::singularize($this->setupTable) . '_id'; |
|
| 73 | + $this->options['junction_local_key'] = Text::singularize($this->setupTable).'_id'; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | if (!isset($this->options['junction_foreign_key'])) { |
| 77 | - $this->options['junction_foreign_key'] = Text::singularize($foreignModel->getDBStoreInformation()['table']) . '_id'; |
|
| 77 | + $this->options['junction_foreign_key'] = Text::singularize($foreignModel->getDBStoreInformation()['table']).'_id'; |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
@@ -26,10 +26,10 @@ |
||
| 26 | 26 | |
| 27 | 27 | namespace ntentan\nibii\relationships; |
| 28 | 28 | |
| 29 | -use ntentan\utils\Text; |
|
| 30 | 29 | use ntentan\nibii\NibiiException; |
| 31 | -use ntentan\nibii\Relationship; |
|
| 32 | 30 | use ntentan\nibii\ORMContext; |
| 31 | +use ntentan\nibii\Relationship; |
|
| 32 | +use ntentan\utils\Text; |
|
| 33 | 33 | |
| 34 | 34 | class ManyHaveManyRelationship extends Relationship |
| 35 | 35 | { |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | |
| 54 | 54 | public function runSetup() { |
| 55 | 55 | if ($this->options['foreign_key'] == null) { |
| 56 | - $this->options['foreign_key'] = Text::singularize($this->setupTable) . '_id'; |
|
| 56 | + $this->options['foreign_key'] = Text::singularize($this->setupTable).'_id'; |
|
| 57 | 57 | } |
| 58 | 58 | if ($this->options['local_key'] == null) { |
| 59 | 59 | $this->options['local_key'] = $this->setupPrimaryKey[0]; |
@@ -27,7 +27,6 @@ |
||
| 27 | 27 | namespace ntentan\nibii\relationships; |
| 28 | 28 | |
| 29 | 29 | use ntentan\utils\Text; |
| 30 | -use ntentan\nibii\ORMContext; |
|
| 31 | 30 | |
| 32 | 31 | class HasManyRelationship extends \ntentan\nibii\Relationship { |
| 33 | 32 | |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | return $this->evaluateResult( |
| 71 | - $field, $testItem->count() === 0, "The value of " . implode(', ', $field['name']) . " must be unique" |
|
| 71 | + $field, $testItem->count() === 0, "The value of ".implode(', ', $field['name'])." must be unique" |
|
| 72 | 72 | ); |
| 73 | 73 | } |
| 74 | 74 | |
@@ -103,6 +103,9 @@ |
||
| 103 | 103 | return $relationshipDetails; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | + /** |
|
| 107 | + * @param string $type |
|
| 108 | + */ |
|
| 106 | 109 | private function createRelationships($type, $relationships) |
| 107 | 110 | { |
| 108 | 111 | foreach ($relationships as $relationship) { |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | |
| 5 | 5 | use ntentan\atiaa\DbContext; |
| 6 | 6 | use ntentan\kaikai\Cache; |
| 7 | -use ntentan\nibii\interfaces\ModelFactoryInterface; |
|
| 8 | 7 | use ntentan\nibii\interfaces\DriverAdapterFactoryInterface; |
| 8 | +use ntentan\nibii\interfaces\ModelFactoryInterface; |
|
| 9 | 9 | use ntentan\nibii\interfaces\ValidatorFactoryInterface; |
| 10 | 10 | |
| 11 | 11 | /** |
@@ -89,6 +89,9 @@ |
||
| 89 | 89 | return $this->config; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | + /** |
|
| 93 | + * @param RecordWrapper $model |
|
| 94 | + */ |
|
| 92 | 95 | public function getModelDescription($model) : ModelDescription |
| 93 | 96 | { |
| 94 | 97 | return new ModelDescription($model); |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | |
| 24 | 24 | public function createDriverAdapter() |
| 25 | 25 | { |
| 26 | - $class = 'ntentan\nibii\adapters\\' . Text::ucamelize($this->driverName) . 'Adapter'; |
|
| 26 | + $class = 'ntentan\nibii\adapters\\'.Text::ucamelize($this->driverName).'Adapter'; |
|
| 27 | 27 | return new $class(); |
| 28 | 28 | } |
| 29 | 29 | } |