@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | return [ |
| 73 | 73 | 'path' => $mapper->getDestination() . $class->getName() . '.php', |
| 74 | 74 | 'contents' => $this->classPrinter->printFile($file) |
| 75 | - . PHP_EOL |
|
| 76 | - . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '') |
|
| 77 | - . $this->classPrinter->printClass($class) |
|
| 75 | + . PHP_EOL |
|
| 76 | + . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '') |
|
| 77 | + . $this->classPrinter->printClass($class) |
|
| 78 | 78 | ]; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | return [ |
| 94 | 94 | 'path' => $mapper->getDestination() . $class->getName() . '.php', |
| 95 | 95 | 'contents' => $this->classPrinter->printFile($file) |
| 96 | - . PHP_EOL |
|
| 97 | - . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '') |
|
| 98 | - . $this->classPrinter->printClass($class) |
|
| 96 | + . PHP_EOL |
|
| 97 | + . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '') |
|
| 98 | + . $this->classPrinter->printClass($class) |
|
| 99 | 99 | ]; |
| 100 | 100 | |
| 101 | 101 | } |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | return [ |
| 111 | 111 | 'path' => $mapper->getDestination() . $class->getName() . '.php', |
| 112 | 112 | 'contents' => $this->classPrinter->printFile($file) |
| 113 | - . PHP_EOL |
|
| 114 | - . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '') |
|
| 115 | - . $this->classPrinter->printClass($class) |
|
| 113 | + . PHP_EOL |
|
| 114 | + . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '') |
|
| 115 | + . $this->classPrinter->printClass($class) |
|
| 116 | 116 | ]; |
| 117 | 117 | } |
| 118 | 118 | |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | return [ |
| 133 | 133 | 'path' => $mapper->getDestination() . $class->getName() . '.php', |
| 134 | 134 | 'contents' => $this->classPrinter->printFile($file) |
| 135 | - . PHP_EOL |
|
| 136 | - . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '') |
|
| 137 | - . $this->classPrinter->printClass($class) |
|
| 135 | + . PHP_EOL |
|
| 136 | + . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '') |
|
| 137 | + . $this->classPrinter->printClass($class) |
|
| 138 | 138 | ]; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -152,9 +152,9 @@ discard block |
||
| 152 | 152 | return [ |
| 153 | 153 | 'path' => $mapper->getEntityDestination() . $class->getName() . '.php', |
| 154 | 154 | 'contents' => $this->classPrinter->printFile($file) |
| 155 | - . PHP_EOL |
|
| 156 | - . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '') |
|
| 157 | - . $this->classPrinter->printClass($class) |
|
| 155 | + . PHP_EOL |
|
| 156 | + . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '') |
|
| 157 | + . $this->classPrinter->printClass($class) |
|
| 158 | 158 | ]; |
| 159 | 159 | } |
| 160 | 160 | |
@@ -174,9 +174,9 @@ discard block |
||
| 174 | 174 | return [ |
| 175 | 175 | 'path' => $mapper->getEntityDestination() . $class->getName() . '.php', |
| 176 | 176 | 'contents' => $this->classPrinter->printFile($file) |
| 177 | - . PHP_EOL |
|
| 178 | - . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '') |
|
| 179 | - . $this->classPrinter->printClass($class) |
|
| 177 | + . PHP_EOL |
|
| 178 | + . ($class->getNamespace() ? $this->classPrinter->printNamespace($class->getNamespace()) : '') |
|
| 179 | + . $this->classPrinter->printClass($class) |
|
| 180 | 180 | ]; |
| 181 | 181 | |
| 182 | 182 | } |
@@ -363,7 +363,7 @@ |
||
| 363 | 363 | { |
| 364 | 364 | return $this->addColumn( |
| 365 | 365 | Column::integer($name, true) |
| 366 | - ->setAutoIncrement(true) |
|
| 366 | + ->setAutoIncrement(true) |
|
| 367 | 367 | ); |
| 368 | 368 | } |
| 369 | 369 | |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | static public function make($createdAtColumn = 'created_at', $updatedAtColumn = 'updated_at') |
| 19 | 19 | { |
| 20 | 20 | return (new static) |
| 21 | - ->setCreatedAtColumn($createdAtColumn) |
|
| 22 | - ->setUpdatedAtColumn($updatedAtColumn); |
|
| 21 | + ->setCreatedAtColumn($createdAtColumn) |
|
| 22 | + ->setUpdatedAtColumn($updatedAtColumn); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | function getName(): string |
@@ -59,13 +59,13 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | if ($this->createdAtColumn && ! array_key_exists($this->createdAtColumn, $columns)) { |
| 61 | 61 | $mapper->addColumn(Column::datetime($this->createdAtColumn) |
| 62 | - ->setNullable(true)); |
|
| 62 | + ->setNullable(true)); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if ($this->updatedAtColumn && ! array_key_exists($this->updatedAtColumn, $columns)) { |
| 66 | 66 | $mapper->addColumn(Column::datetime($this->updatedAtColumn) |
| 67 | - ->setNullable(true) |
|
| 68 | - ->setAfter($this->createdAtColumn)); |
|
| 67 | + ->setNullable(true) |
|
| 68 | + ->setAfter($this->createdAtColumn)); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | return $this; |
@@ -74,35 +74,35 @@ discard block |
||
| 74 | 74 | public function observeBaseQueryClass(ClassType $class): ClassType |
| 75 | 75 | { |
| 76 | 76 | $class->addProperty('createdAtColumn', $this->createdAtColumn) |
| 77 | - ->setVisibility('protected'); |
|
| 77 | + ->setVisibility('protected'); |
|
| 78 | 78 | $class->addProperty('updatedAtColumn', $this->updatedAtColumn) |
| 79 | - ->setVisibility('protected'); |
|
| 79 | + ->setVisibility('protected'); |
|
| 80 | 80 | |
| 81 | 81 | // add methods |
| 82 | 82 | $class->addMethod('orderByFirstCreated') |
| 83 | - ->setVisibility('public') |
|
| 84 | - ->setBody(' |
|
| 83 | + ->setVisibility('public') |
|
| 84 | + ->setBody(' |
|
| 85 | 85 | $this->orderBy($this->createdAtColumn . \' ASC\'); |
| 86 | 86 | |
| 87 | 87 | return $this; |
| 88 | 88 | '); |
| 89 | 89 | $class->addMethod('orderByLastCreated') |
| 90 | - ->setVisibility('public') |
|
| 91 | - ->setBody(' |
|
| 90 | + ->setVisibility('public') |
|
| 91 | + ->setBody(' |
|
| 92 | 92 | $this->orderBy($this->createdAtColumn . \' DESC\'); |
| 93 | 93 | |
| 94 | 94 | return $this; |
| 95 | 95 | '); |
| 96 | 96 | $class->addMethod('orderByFirstUpdated') |
| 97 | - ->setVisibility('public') |
|
| 98 | - ->setBody(' |
|
| 97 | + ->setVisibility('public') |
|
| 98 | + ->setBody(' |
|
| 99 | 99 | $this->orderBy($this->updatedAtColumn . \' ASC\'); |
| 100 | 100 | |
| 101 | 101 | return $this; |
| 102 | 102 | '); |
| 103 | 103 | $class->addMethod('orderByLastCreated') |
| 104 | - ->setVisibility('public') |
|
| 105 | - ->setBody(' |
|
| 104 | + ->setVisibility('public') |
|
| 105 | + ->setBody(' |
|
| 106 | 106 | $this->orderBy($this->updatedAtColumn . \' DESC\'); |
| 107 | 107 | |
| 108 | 108 | return $this; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | if ( ! $class->hasMethod('init')) { |
| 120 | 120 | $class->addMethod('init')->setVisibility('public') |
| 121 | - ->setBody('parent::init();' . PHP_EOL); |
|
| 121 | + ->setBody('parent::init();' . PHP_EOL); |
|
| 122 | 122 | } |
| 123 | 123 | $class->getNamespace()->addUse(\Sirius\Orm\Behaviour\Timestamps::class); |
| 124 | 124 | $method = $class->getMethod('init'); |