DataImport
extends AbstractBaseCommand
in package
This command will import data from a json file The format for the json is:
{ "Full\Path\To\Model\Class": [ { "insert": true, "storeId": "placeholder", "search": { "column": "value" }, "data": { "column": "value" } } ] }
You can specify more classes and, of course, more element to be updated per Class. Be aware that the command will match ALL ROWS that sadify the seachColumn and searchValue rule, and update all of them.
The signature for the command is: athomos:data-import {--Y|yes} {fileName}
The fileName should be relative to the root of the project
Table of Contents
- $description : string
- The command description
- $signature : string
- The command signature
- $silent : bool
- Suppress all info,error,warn and printWelcome output messages use `$this->line` instead to force writing output in silent mode
- __construct() : mixed
- Constructor, it will start a new batch to group all log items
- call() : int
- Call another console command.
- error() : void
- Print an <error>$string</error> message
- handle() : void
- This function will handle all the logic of the command
- info() : void
- Print an <info>$string</info> message
- warn() : void
- Print an <error>$string</error> message
- printWelcome() : bool
- Prints a Welcome message
Properties
$description
The command description
protected
string
$description
= "This command will import data from a json file"
$signature
The command signature
protected
string
$signature
= "athomos:data-import {--Y|yes} {fileName}"
$silent
Suppress all info,error,warn and printWelcome output messages use `$this->line` instead to force writing output in silent mode
protected
bool
$silent
= false
Methods
__construct()
Constructor, it will start a new batch to group all log items
public
__construct() : mixed
Return values
mixed —call()
Call another console command.
public
call( $command[, array<string|int, mixed> $arguments = [] ]) : int
Parameters
Return values
int —error()
Print an <error>$string</error> message
public
error( $string[, $verbosity = null ]) : void
Parameters
Return values
void —handle()
This function will handle all the logic of the command
public
handle() : void
Tags
Return values
void —info()
Print an <info>$string</info> message
public
info( $string[, $verbosity = null ]) : void
Parameters
Return values
void —warn()
Print an <error>$string</error> message
public
warn( $string[, $verbosity = null ]) : void
Parameters
Return values
void —printWelcome()
Prints a Welcome message
protected
printWelcome([string|null $message = null ][, bool $assumeYes = false ]) : bool
Parameters
- $message : string|null = null
- $assumeYes : bool = false