You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 08ef92f
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/changelogs/v4.8.0.md
+19-18Lines changed: 19 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,8 +65,8 @@ Release Date: Unreleased
65
65
66
66
-**CLI:** The `Console::run()` method now accepts an optional `array $tokens` parameter. This allows you to pass an array of command tokens directly to the console runner, which is useful for testing or programmatically running commands. If not provided, it will default to using the global `$argv`.
67
67
68
-
-**CodeIgniter:** The deprecated parameters in methods have been removed:
69
-
-`CodeIgniter\CodeIgniter::handleRequest()` no longer accepts the deprecated `$cacheConfig` and `$returnResponse` parameters.
68
+
-**CodeIgniter:** The deprecated parameters in methods have been removed:
69
+
-`CodeIgniter\CodeIgniter::handleRequest()` no longer accepts the deprecated `$cacheConfig` and `$returnResponse` parameters.
70
70
- `$cacheConfig` is no longer used and is now hard deprecated. A deprecation notice will be triggered if this is passed to the method.
71
71
- `$returnResponse` has been removed, since it was already deprecated and unused.
72
72
- The updated method signature is now `handleRequest(?RouteCollectionInterface $routes, ?Cache $cacheConfig = null)`.
@@ -75,7 +75,7 @@ Release Date: Unreleased
75
75
76
76
-**Config:**`CodeIgniter\Config\Services::request()` no longer accepts any parameter.
77
77
78
-
-**Database:** The following methods have had their signatures updated to remove deprecated parameters:
78
+
-**Database:** The following methods have had their signatures updated to remove deprecated parameters:
79
79
-`CodeIgniter\Database\Forge::_createTable()` no longer accepts the deprecated `$ifNotExists` parameter. The method signature is now `_createTable(string $table, array $attributes)`.
80
80
81
81
-**HTTP:**`CodeIgniter\HTTP\OutgoingRequest::__construct()` now requires the `$uri` parameter, which was previously `?URI $uri = null`. Passing `null` only worked when a `Host` header was supplied in the same call, since the constructor otherwise dereferences the URI to set that header. Consequently `OutgoingRequest::getUri()` now returns `URI` instead of `URI|null`, matching `OutgoingRequestInterface`. See [Upgrading from 4.7.x to 4.8.0](../installation/upgrade_480.md) for the migration.
@@ -86,41 +86,41 @@ Release Date: Unreleased
86
86
87
87
### Property Scope Changes
88
88
89
-
-**HTTP:** The following properties have changed their scope (visibility):
89
+
-**HTTP:** The following properties have changed their scope (visibility):
90
90
-`CodeIgniter\HTTP\RequestTrait::$ipAddress` is now private (previously protected).
91
91
92
92
### Method Scope Changes
93
93
94
94
-**CLI:**`CodeIgniter\CLI\Commands::getCommandAlternatives()` is now public (previously protected).
95
95
96
-
-**HTTP:** The following methods have changed their scope (visibility):
96
+
-**HTTP:** The following methods have changed their scope (visibility):
97
97
-`CodeIgniter\HTTP\URI::setUri()` is now private (previously public).
98
98
-`CodeIgniter\HTTP\URI::refreshPath()` is now protected (previously public).
99
99
-`CodeIgniter\HTTP\SiteURI::refreshPath()` is now protected (previously public).
100
100
101
101
### Removed Deprecated Items
102
102
103
-
-**Autoloader:** Removed the following deprecated methods:
103
+
-**Autoloader:** Removed the following deprecated methods:
-**Filters:** Removed the following deprecated properties and methods:
175
+
-**Filters:** Removed the following deprecated properties and methods:
176
176
-`CodeIgniter\Filters\Filters::$arguments` (deprecated since v4.6.0)
177
177
-`CodeIgniter\Filters\Filters::$argumentsClass` (deprecated since v4.6.0)
178
178
-`CodeIgniter\Filters\Filters::getArguments()` (deprecated since v4.6.0)
179
179
180
-
-**HTTP:** Removed the following deprecated properties and methods:
180
+
-**HTTP:** Removed the following deprecated properties and methods:
181
181
-`CodeIgniter\HTTP\Message::getHeaders()` (deprecated since v4.0.5)
182
182
-`CodeIgniter\HTTP\Message::getHeader()` (deprecated since v4.0.5)
183
183
-`CodeIgniter\HTTP\RequestTrait::getEnv()` (deprecated since v4.4.4)
@@ -190,7 +190,7 @@ Release Date: Unreleased
190
190
-`CodeIgniter\HTTP\SiteURI::setBaseURL()` (deprecated since v4.4.0)
191
191
-`CodeIgniter\HTTP\SiteURI::setURI()` (deprecated since v4.4.0)
192
192
193
-
-**Security:** Removed the following deprecated properties and methods:
193
+
-**Security:** Removed the following deprecated properties and methods:
194
194
-`CodeIgniter\Security\SecurityInterface::sanitizeFilename()` (deprecated since v4.6.2)
195
195
-`CodeIgniter\Security\Security::sanitizeFilename()` (deprecated since v4.6.2)
196
196
-`CodeIgniter\Security\Security::$csrfProtection` (deprecated since v4.4.0)
@@ -341,6 +341,7 @@ Release Date: Unreleased
341
341
### Others
342
342
343
343
-**Config:** Added optional `CodeIgniter\Config\Merge` directives for [Registrars](../general/configuration.md#registrars) to control replacing, deep merging, and ordered list additions. Existing registrar merge behavior is unchanged. See [Controlling how values are merged](../general/configuration.md#controlling-how-values-are-merged).
344
+
-**Entity:** Added a new `CodeIgniter\Entity\Entity::$mergeAttributesOnInject` property. See [Merging Attributes During Injection](../models/entities.md#merging-attributes-during-injection).
344
345
-**Float and Double Casting:** Added support for precision and rounding mode when casting to float or double in entities.
345
346
- Added `CodeIgniter\Input\InputData`, `ValidatedInput`, and `InputDataFactory` for reusable typed input data objects.
346
347
- Float and Double casting now throws `CastException::forInvalidFloatRoundingMode()` if a rounding mode other than up, down, even, or odd is provided.
-`CLI.commandAlias` and `CLI.helpAliases` (command alias rendering in `list` and `help`)
356
357
-`CLI.altCommandNone`, `CLI.altCommandRun`, and `CLI.altCommandSelect` (correcting a mistyped command)
357
358
-`CLI.generator.invalidCommandType` (`make:command` rejecting an invalid `--type`)
358
359
-`CLI.generator.invalidReturnType` (`make:model` rejecting an invalid `--return`)
359
360
-`Commands.invalidCommandAlias`, `Commands.commandAliasSameAsName`, `Commands.duplicateCommandAlias`, `Commands.aliasClashesWithCommandName`, and `Commands.aliasClashesWithAlias` (command alias validation)
360
361
361
-
- Removed deprecated language keys tied to removed exception constructors:
362
+
- Removed deprecated language keys tied to removed exception constructors:
Copy file name to clipboardExpand all lines: docs/installation/upgrade_480.md
+15-11Lines changed: 15 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -144,6 +144,10 @@ public function handle($level, $message, array $context = []): bool
144
144
145
145
The context array may contain the CI global context data under the `HandlerInterface::GLOBAL_CONTEXT_KEY` (`'_ci_context'`) key when `$logGlobalContext` is enabled in `Config\Logger`.
146
146
147
+
### Entity
148
+
149
+
If you redefine the Entity base class or modify the `injectRawData()` method, you need to add a new `$mergeAttributesOnInject` property. See [Merging Attributes During Injection](../models/entities.md#merging-attributes-during-injection).
150
+
147
151
## Project Files
148
152
149
153
Some files in the **project space** (root, app, public, writable) received updates. Due to these files being outside of the **system** scope they will not be changed without your intervention.
@@ -157,39 +161,39 @@ The following files received significant changes (including deprecations or visu
157
161
158
162
#### Config
159
163
160
-
-**app/Config/Filters.php**
164
+
-**app/Config/Filters.php**
161
165
- Added a new filter named `requestid` that adds a unique request ID to each request in the application's context.
162
166
163
-
-**app/Config/Generators.php**
167
+
-**app/Config/Generators.php**
164
168
-`Config\Generators::$views` added entries for `make:request`, `make:test`, and `make:transformer`, and dropped the stale `session:migration` entry.
165
169
166
-
-**app/Config/Logger.php**
170
+
-**app/Config/Logger.php**
167
171
-`Config\Logger::$handlers` added a new key `stopChainOnFailure` to the `FileHandler` and `ErrorlogHandler` settings.
168
172
169
-
-**app/Config/Mimes.php**
173
+
-**app/Config/Mimes.php**
170
174
-`Config\Mimes::$mimes` added a new key `md` for Markdown files.
171
175
172
-
-**app/Config/Routing.php**
176
+
-**app/Config/Routing.php**
173
177
-`Config\Routing::$placeholderSamples` was added to provide sample values for custom route placeholders so the `spark routes` command can resolve their filters.
174
178
175
-
-**app/Config/Security.php**
179
+
-**app/Config/Security.php**
176
180
-`Config\Security::$csrfFetchMetadata` and `Config\Security::$csrfFetchMetadataRejectSameSite` were added for Fetch Metadata based CSRF protection.
177
181
178
182
#### Error Views
179
183
180
-
-**app/Views/errors/cli/error_exception.php**
184
+
-**app/Views/errors/cli/error_exception.php**
181
185
- Shows the backtrace also when the command runs with `-v`.
182
186
183
-
-**app/Views/errors/html/debug.css**
187
+
-**app/Views/errors/html/debug.css**
184
188
- Added styles for the **Copy Details** button.
185
189
186
-
-**app/Views/errors/html/debug.js**
190
+
-**app/Views/errors/html/debug.js**
187
191
- Added clipboard handling for the **Copy Details** button.
188
192
189
-
-**app/Views/errors/html/error_exception.php**
193
+
-**app/Views/errors/html/error_exception.php**
190
194
- Added a **Copy Details** button to detailed HTML exception pages.
191
195
192
-
-**app/Views/errors/html/error_report.php**
196
+
-**app/Views/errors/html/error_report.php**
193
197
- Added a Markdown error report partial used by the **Copy Details** button.
Copy file name to clipboardExpand all lines: docs/models/entities.md
+59Lines changed: 59 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -780,3 +780,62 @@ For scalar values (strings, integers, floats, booleans, null), the Entity uses d
780
780
#### Objects and Arrays
781
781
782
782
For objects and arrays, the Entity JSON-encodes and normalizes the values for comparison. This means that modifications to nested structures, object properties, array elements, nested entities (using `toRawArray()`), enums (`BackedEnum` and `UnitEnum`), datetime objects (`DateTimeInterface`), collections (`Traversable`), value objects with `__toString()`, and objects implementing `JsonSerializable` or `toArray()` will be properly detected.
783
+
784
+
### Merging Attributes During Injection
785
+
786
+
!!! success "Available from version 4.8.0"
787
+
788
+
By default, your entity can contain the initial state of the attributes. When working with objects, you can rely on the fact that all the necessary properties are available. However, after receiving the object from the database, you may find that the entity is not complete and some properties are missing.
789
+
790
+
Suppose there is no `isBanned` field in the table, and the `profile` property is virtual and filled in another way.
791
+
792
+
With the `$mergeAttributesOnInject = false` you will get errors because by default properties are overwritten in `injectRawData()`.
0 commit comments