Skip to content

Commit 5c3e097

Browse files
authored
Feature Fields (#116)
* Update PutDocumentFieldUpdate
1 parent 15d20b9 commit 5c3e097

23 files changed

+99
-95
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ $thumbnail = $connector->send(new GetDocumentDownloadThumbnailRequest($fileCabin
171171
/**
172172
* Update value of a indexed field.
173173
*/
174-
$value = $connector->send(new PutDocumentFieldsRequest($fileCabinetId, $documentId, [$fieldName => $newValue]))->dto()[$fieldName];
174+
$value = $connector->send(new PutDocumentFieldsRequest($fileCabinetId, $documentId, [$fieldName => $newValue]))->dto();
175175

176176
/**
177177
* Update multiple values of indexed fields.
@@ -401,35 +401,35 @@ Please see [Tests](tests/Feature/DocuWare.php) for more details.
401401
```php
402402
CodebarAg\DocuWare\DTO\DocumentIndex\IndexTextDTO {
403403
+name: "FIELD_TEXT" // string
404-
+value: "Value" // string
404+
+value: "Value" // null|string
405405
}
406406
```
407407

408408
```php
409409
CodebarAg\DocuWare\DTO\DocumentIndex\IndexNumericDTO {
410410
+name: "FIELD_NUMERIC" // string
411-
+value: 1 // int
411+
+value: 1 // null|int
412412
}
413413
```
414414

415415
```php
416416
CodebarAg\DocuWare\DTO\DocumentIndex\IndexDecimalDTO {
417417
+name: "FIELD_DECIMAL" // string
418-
+value: 1.00 // int|float
418+
+value: 1.00 // null|int|float
419419
}
420420
```
421421

422422
```php
423423
use CodebarAg\DocuWare\DTO\DocumentIndex\IndexDateDTO {
424424
+name: "FIELD_DATE" // string
425-
+value: now(), // Carbon
425+
+value: now(), // null|Carbon
426426
}
427427
```
428428

429429
```php
430430
use CodebarAg\DocuWare\DTO\DocumentIndex\IndexDateTimeDTO {
431431
+name: "FIELD_DATETIME" // string
432-
+value: now(), // Carbon
432+
+value: now(), // null|Carbon
433433
}
434434
```
435435

@@ -451,7 +451,7 @@ use CodebarAg\DocuWare\DTO\DocumentIndex\IndexTableDTO {
451451
'VALUE' => 1.00,
452452
],
453453
]
454-
]) // Collection|array
454+
]) // null|Collection|array
455455
}
456456
```
457457

src/DTO/Dialog.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ public function isSearch(): bool
3535
}
3636

3737
public static function fake(
38-
string $id = null,
39-
string $type = null,
40-
string $label = null,
41-
bool $isDefault = null,
42-
string $fileCabinetId = null,
38+
?string $id = null,
39+
?string $type = null,
40+
?string $label = null,
41+
?bool $isDefault = null,
42+
?string $fileCabinetId = null,
4343
): self {
4444
return new self(
4545
id: $id ?? (string) Str::uuid(),

src/DTO/Document.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,18 @@ public function fileName(): string
105105
}
106106

107107
public static function fake(
108-
int $id = null,
109-
int $file_size = null,
110-
int $total_pages = null,
111-
string $title = null,
112-
string $extension = null,
113-
string $content_type = null,
114-
string $file_cabinet_id = null,
115-
string $intellixTrust = null,
116-
Carbon $created_at = null,
117-
Carbon $updated_at = null,
118-
Collection $fields = null,
119-
Collection $suggestions = null,
108+
?int $id = null,
109+
?int $file_size = null,
110+
?int $total_pages = null,
111+
?string $title = null,
112+
?string $extension = null,
113+
?string $content_type = null,
114+
?string $file_cabinet_id = null,
115+
?string $intellixTrust = null,
116+
?Carbon $created_at = null,
117+
?Carbon $updated_at = null,
118+
?Collection $fields = null,
119+
?Collection $suggestions = null,
120120
): self {
121121
return new self(
122122
id: $id ?? random_int(1, 999999),

src/DTO/DocumentField.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ public function __construct(
3333

3434
public static function fake(
3535
?bool $systemField = false,
36-
string $name = null,
37-
string $label = null,
36+
?string $name = null,
37+
?string $label = null,
3838
?bool $isNull = true,
39-
int|float|Carbon|string $value = null,
40-
string $type = null,
39+
int|float|Carbon|string|null $value = null,
40+
?string $type = null,
4141
): self {
4242
$fakeType = Arr::random(['Int', 'Decimal', 'Text', 'DateTime']);
4343

src/DTO/DocumentIndex/IndexDateDTO.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ class IndexDateDTO
88
{
99
public function __construct(
1010
public string $name,
11-
public Carbon $value,
11+
public null|Carbon|\Carbon\Carbon $value,
1212
) {
1313

1414
}
1515

16-
public static function make(string $name, Carbon $value): self
16+
public static function make(string $name, null|Carbon|\Carbon\Carbon $value): self
1717
{
1818
return new self($name, $value);
1919
}

src/DTO/DocumentIndex/IndexDateTimeDTO.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ class IndexDateTimeDTO
88
{
99
public function __construct(
1010
public string $name,
11-
public Carbon $value,
11+
public null|Carbon|\Carbon\Carbon $value,
1212
) {
1313

1414
}
1515

16-
public static function make(string $name, Carbon $value): self
16+
public static function make(string $name, null|Carbon|\Carbon\Carbon $value): self
1717
{
1818
return new self($name, $value);
1919
}

src/DTO/DocumentIndex/IndexDecimalDTO.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ class IndexDecimalDTO
66
{
77
public function __construct(
88
public string $name,
9-
public int|float $value,
9+
public null|int|float $value,
1010
) {
1111

1212
}
1313

14-
public static function make(string $name, int|float $value): self
14+
public static function make(string $name, null|int|float $value): self
1515
{
1616
return new self($name, $value);
1717
}

src/DTO/DocumentIndex/IndexNumericDTO.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ class IndexNumericDTO
88

99
public function __construct(
1010
public string $name,
11-
public int $value,
11+
public ?int $value,
1212
) {
1313

1414
}
1515

16-
public static function make(string $name, int $value): self
16+
public static function make(string $name, ?int $value): self
1717
{
1818
return new self($name, $value);
1919
}

src/DTO/DocumentIndex/IndexTableDTO.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ class IndexTableDTO
99
{
1010
public function __construct(
1111
public string $name,
12-
public Collection|array $rows,
12+
public null|Collection|array $rows,
1313
) {
1414

1515
}
1616

17-
public static function make(string $name, Collection|array $rows): self
17+
public static function make(string $name, null|Collection|array $rows): self
1818
{
1919
return new self($name, $rows);
2020
}
@@ -33,7 +33,7 @@ public function values(): array
3333

3434
protected function rowsCollection(): array
3535
{
36-
return collect($this->rows)->map(function ($row) {
36+
return collect($this->rows ?? [])->map(function ($row) {
3737

3838
$indexes = collect($row)->map(function ($column) {
3939

src/DTO/DocumentIndex/IndexTextDTO.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ class IndexTextDTO
66
{
77
public function __construct(
88
public string $name,
9-
public string $value,
9+
public ?string $value,
1010
) {
1111

1212
}
1313

14-
public static function make(string $name, string $value): self
14+
public static function make(string $name, ?string $value): self
1515
{
1616
return new self($name, $value);
1717
}

0 commit comments

Comments
 (0)