Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"license": "MIT",
"require": {
"php": "^7.4|^8.0",
"adt/background-queue": "^4.21",
"adt/background-queue": "^4.22",
"nette/di": "^2.4|^3.0",
"nette/schema": "^1.2"
},
Expand Down
2 changes: 2 additions & 0 deletions src/DI/BackgroundQueueExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function getConfigSchema(): Schema
'tempDir' => Expect::string()->required(),
'locksDir' => Expect::string()->required(),
'queue' => Expect::string()->required(),
'bulkSize' => Expect::int(1)->min(1),
'priorities' => Expect::arrayOf(Expect::int()->min(1))->default([1])->mergeDefaults(false),
'connection' => Expect::anyOf('string', Expect::arrayOf('int|string|object', 'string')),
'tableName' => Expect::string('background_job'),
Expand All @@ -45,6 +46,7 @@ public function getConfigSchema(): Schema
'onError' => Expect::type('callable')->nullable(),
'onAfterProcess' => Expect::type('callable')->nullable(),
'onProcessingGetMetadata' => Expect::type('callable')->nullable(),
'parametersFormat' => Expect::string()->nullable(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nejde tady dát něco jako enum?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bylo by to moc komplikované, pokud chceme v neno konfigu pak použít např.

parametersFormat: @ADT\BackgroundQueue\Entity\BackgroundJob::PARAMETERS_FORMAT_JSON

při definici jako je tato

'parametersFormat' => Expect::anyOf(BackgroundJob::PARAMETERS_FORMAT_SERIALIZE, BackgroundJob::PARAMETERS_FORMAT_JSON)->default(BackgroundJob::PARAMETERS_FORMAT_SERIALIZE),

Pak nám to hlásí chybu.

The item 'backgroundQueue › parametersFormat' expects to be 'serialize'|'json', '@ADT...' given.

Nechal bych volitelně string a kontrola je pak v hlavní knihovně BacgroundQueue.

]);
}

Expand Down