DocumentsCommandActions uses trait:short, trait:short, trait:short, trait:short, trait:short, trait:short, trait:short, trait:short, trait:short, trait:short, trait:short
Table of Contents
Methods
- count() : int
- Count the number of documents in the model.
- delete() : int
- Executes the action to delete one or more documents from the collection.
- exist() : int
- Checks if all provided documents exist in the collection.
- get() : int
- Executes the action to fetch and display a single document by its identifier.
- insert() : int
- Insert a new document in the collection.
- last() : int
- Executes the action to fetch and display the last document in the model.
- list() : int
- Executes the action to list all documents from the model.
- replace() : int
- Replace a document in the collection.
- truncate() : int
- Truncate the collection and remove all documents.
- update() : int
- Updates a document in the collection.
- upsert() : int
- Upsert a document in the collection.
Methods
count()
Count the number of documents in the model.
protected
count(InputInterface $input, OutputInterface $output[, mixed|null $option = null ]) : int
Parameters
- $input : InputInterface
- $output : OutputInterface
- $option : mixed|null = null
Tags
Return values
intdelete()
Executes the action to delete one or more documents from the collection.
protected
delete(InputInterface $input, OutputInterface $output[, mixed|null $option = null ]) : int
Identifiers for the documents to be deleted should be provided as a single comma-separated string. The command's exit code does not reflect whether documents were actually deleted, only that the operation ran successfully.
Parameters
- $input : InputInterface
-
The console input instance.
- $output : OutputInterface
-
The console output instance.
- $option : mixed|null = null
-
A comma-separated string of document identifiers.
Tags
Return values
int —Always returns ExitCode::SUCCESS.
exist()
Checks if all provided documents exist in the collection.
protected
exist(InputInterface $input, OutputInterface $output[, mixed|null $option = null ]) : int
This method takes a single identifier or an array of identifiers and verifies their existence. The command's exit code does not reflect the outcome of the existence check; it only indicates that the operation itself completed successfully.
Parameters
- $input : InputInterface
-
The console input instance.
- $output : OutputInterface
-
The console output instance.
- $option : mixed|null = null
-
A single identifier or an array of identifiers to check.
Tags
Return values
int —Always returns ExitCode::SUCCESS.
get()
Executes the action to fetch and display a single document by its identifier.
protected
get(InputInterface $input, OutputInterface $output[, array<string|int, mixed> $option = [] ]) : int
Parameters
- $input : InputInterface
-
The console input instance.
- $output : OutputInterface
-
The console output instance.
- $option : array<string|int, mixed> = []
-
An array where the first element is the identifier of the document to retrieve.
Tags
Return values
int —The exit code for the command, typically ExitCode::SUCCESS.
insert()
Insert a new document in the collection.
protected
insert(InputInterface $input, OutputInterface $output[, string|array<string|int, mixed>|null $option = null ]) : int
Parameters
- $input : InputInterface
- $output : OutputInterface
- $option : string|array<string|int, mixed>|null = null
-
The option to configure the action.
Tags
Return values
intlast()
Executes the action to fetch and display the last document in the model.
protected
last(InputInterface $input, OutputInterface $output[, array<string|int, mixed> $option = [] ]) : int
Parameters
- $input : InputInterface
-
The console input instance.
- $output : OutputInterface
-
The console output instance.
- $option : array<string|int, mixed> = []
-
An array of optional parameters to send in the command.
Tags
Return values
int —The exit code for the command, typically ExitCode::SUCCESS.
list()
Executes the action to list all documents from the model.
protected
list(InputInterface $input, OutputInterface $output[, mixed|null $option = null ]) : int
Parameters
- $input : InputInterface
-
The console input instance.
- $output : OutputInterface
-
The console output instance.
- $option : mixed|null = null
-
This parameter is currently unused.
Tags
Return values
int —The exit code for the command, typically ExitCode::SUCCESS.
replace()
Replace a document in the collection.
protected
replace(InputInterface $input, OutputInterface $output[, string|array<string|int, mixed>|null $option = null ]) : int
Parameters
- $input : InputInterface
-
The console input instance.
- $output : OutputInterface
-
The console output instance.
- $option : string|array<string|int, mixed>|null = null
-
An array where the first element is the identifier of the document to retrieve.
Tags
Return values
int —The exit code for the command, typically ExitCode::SUCCESS.
truncate()
Truncate the collection and remove all documents.
protected
truncate(InputInterface $input, OutputInterface $output[, mixed|null $option = null ]) : int
Parameters
- $input : InputInterface
- $output : OutputInterface
- $option : mixed|null = null
Return values
intupdate()
Updates a document in the collection.
protected
update(InputInterface $input, OutputInterface $output[, mixed|null $option = null ]) : int
Parameters
- $input : InputInterface
- $output : OutputInterface
- $option : mixed|null = null
Tags
Return values
intupsert()
Upsert a document in the collection.
protected
upsert(InputInterface $input, OutputInterface $output, string|JsonSerializable|null|JsonSerializable|null} $option) : int
Parameters
- $input : InputInterface
- $output : OutputInterface
- $option : string|JsonSerializable|null|JsonSerializable|null}