Skip to content

Commit

Permalink
Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Nov 30, 2023
1 parent 16f3a22 commit 0baf038
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/9.0/reader/record-mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ The attribute can take up to three (3) arguments which are all optional:

- The `column` argument tells the engine which record key to use via its numeric or name. If not present the property name or the name of the first argument of the `setter` method will be used. In such case, you are required to specify the property names information.
- The `cast` argument which accept the name of a class implementing the `TypeCasting` interface and responsible for type casting the record value. If not present, the mechanism will try to resolve the typecasting based on the property or method argument type.
- The `options` argument enables controlling typecasting by providing extra arguments to the `TypeCasting` class constructor. The argument expects an associative array and relies on named arguments to inject its value to the `TypeCasting` implementing class constructor.
- The `options` argument enables controlling typecasting by providing extra arguments to `TypeCasting::setOptions` method. The argument expects an associative array and relies on named arguments to inject its value to the method.

<p class="message-notice">You can use the mechanism on a CSV without a header row but it requires
adding a <code>MapCell</code> attribute on each property or method needed for the conversion. Or you
Expand Down Expand Up @@ -260,7 +260,7 @@ public function setPlace(mixed $place): void
> if the value is null resolve the string `Abidjan` to `Place::Abidjan`. Once created,
> call the method `setPlace` with the created `Place` enum filling the `$place` argument.
<p class="notice">Using this class with a <code>mixed</code> type without providing the <code>enum</code> parameter will trigger an exception.</p>
<p class="notice">Using this class with a <code>mixed</code> type without providing the <code>className</code> parameter will trigger an exception.</p>

### CastToDate

Expand Down
2 changes: 1 addition & 1 deletion src/Serializer/Denormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private function hydrate(object $object, array $record): void
$record = array_values($record);
foreach ($this->propertySetters as $propertySetter) {
$value = $record[$propertySetter->offset];
if ('' === $value && self::$emptyStringAsNull) {
if (is_string($value) && '' === trim($value) && self::$emptyStringAsNull) {
$value = null;
}

Expand Down

0 comments on commit 0baf038

Please sign in to comment.