UpgradeController
- Type
- Class
- Namespace
- craft\commerce\console\controllers
- Inherits
- craft\commerce\console\controllers\UpgradeController » craft\commerce\console\Controller » craft\console\Controller (opens new window) » yii\console\Controller (opens new window) » yii\base\Controller (opens new window) » yii\base\Component (opens new window) » yii\base\BaseObject (opens new window)
- Implements
- yii\base\Configurable (opens new window), yii\base\ViewContextInterface (opens new window)
- Uses traits
- craft\console\ControllerTrait (opens new window)
- Since
- 4.0.0
Command to be run once upgraded to Commerce 4.
View source (opens new window)
# Public Properties
# defaultAction
- Type
- string (opens new window)
- Default value
'run'
The ID of the action that is used when the action ID is not specified in the request. Defaults to 'index'.
View source (opens new window)
# neededCustomAddressFields
- Type
array<string,string>
- Default value
[ 'attention' => 'Attention', 'title' => 'Title', 'address3' => 'Address 3', 'businessId' => 'Business ID', 'phone' => 'Phone Number', 'alternativePhone' => 'Alternative Phone', 'custom1' => 'Custom 1', 'custom2' => 'Custom 2', 'custom3' => 'Custom 3', 'custom4' => 'Custom 4', 'notes' => 'Notes', ]
View source (opens new window)
# Public Methods
Method | Description |
---|---|
__call() (opens new window) | Calls the named method which is not a class method. |
__clone() (opens new window) | This method is called after the object is created by cloning an existing one. |
__construct() (opens new window) | |
__get() (opens new window) | Returns the value of a component property. |
__isset() (opens new window) | Checks if a property is set, i.e. defined and not null. |
__set() (opens new window) | Sets the value of a component property. |
__unset() (opens new window) | Sets a component property to be null. |
_migrateCustomers() | Migrates all guest customers to users. Prepares and cleans up before and after this process. |
_migrateDiscountUses() | |
_migrateOrderHistoryUser() | |
actionRun() | Runs the data migration |
actions() (opens new window) | Declares external actions for the controller. |
afterAction() (opens new window) | This method is invoked right after an action is executed. |
ansiFormat() (opens new window) | Formats a string with ANSI codes. |
attachBehavior() (opens new window) | Attaches a behavior to this component. |
attachBehaviors() (opens new window) | Attaches a list of behaviors to the component. |
beforeAction() (opens new window) | This method is invoked right before an action is executed. |
behaviors() (opens new window) | Returns a list of behaviors that this component should behave as. |
bindActionParams() (opens new window) | Binds the parameters to the action. |
canGetProperty() (opens new window) | Returns a value indicating whether a property can be read. |
canSetProperty() (opens new window) | Returns a value indicating whether a property can be set. |
className() (opens new window) | Returns the fully qualified name of this class. |
confirm() (opens new window) | Asks user to confirm by typing y or n. |
createAction() (opens new window) | Creates an action based on the given action ID. |
createDirectory() (opens new window) | Creates a directory, and outputs to the console. |
detachBehavior() (opens new window) | Detaches a behavior from the component. |
detachBehaviors() (opens new window) | Detaches all behaviors from the component. |
do() (opens new window) | Performs an action with descriptive output. |
ensureBehaviors() (opens new window) | Makes sure that the behaviors declared in behaviors() (opens new window) are attached to this component. |
failure() (opens new window) | Outputs a failure message to the console. |
findLayoutFile() (opens new window) | Finds the applicable layout file. |
getActionArgsHelp() (opens new window) | Returns the help information for the anonymous arguments for the action. |
getActionHelp() (opens new window) | Returns the detailed help information for the specified action. |
getActionHelpSummary() (opens new window) | Returns a one-line short summary describing the specified action. |
getActionOptionsHelp() (opens new window) | Returns the help information for the options for the action. |
getBehavior() (opens new window) | Returns the named behavior object. |
getBehaviors() (opens new window) | Returns all behaviors attached to this component. |
getHelp() (opens new window) | Returns help information for this controller. |
getHelpSummary() (opens new window) | Returns one-line short summary describing this controller. |
getModules() (opens new window) | Returns all ancestor modules of this controller. |
getOptionValues() (opens new window) | Returns properties corresponding to the options for the action id Child classes may override this method to specify possible properties. |
getPassedOptionValues() (opens new window) | Returns the properties corresponding to the passed options. |
getPassedOptions() (opens new window) | Returns the names of valid options passed during execution. |
getRoute() (opens new window) | Returns the route of the current request. |
getUniqueId() (opens new window) | Returns the unique ID of the controller. |
getView() (opens new window) | Returns the view object that can be used to render views or view files. |
getViewPath() (opens new window) | Returns the directory containing view files for this controller. |
hasEventHandlers() (opens new window) | Returns a value indicating whether there is any handler attached to the named event. |
hasMethod() (opens new window) | Returns a value indicating whether a method is defined. |
hasProperty() (opens new window) | Returns a value indicating whether a property is defined for this component. |
init() | |
isColorEnabled() (opens new window) | Returns a value indicating whether ANSI color is enabled. |
isRunning() | |
markdownToAnsi() (opens new window) | Converts Markdown to be better readable in console environments by applying some ANSI format. |
note() (opens new window) | Outputs a note to the console. |
off() (opens new window) | Detaches an existing event handler from this component. |
on() (opens new window) | Attaches an event handler to an event. |
optionAliases() (opens new window) | Returns option alias names. |
options() (opens new window) | Returns the names of valid options for the action (id). |
passwordPrompt() (opens new window) | Prompts the user for a password and validates it. |
prompt() (opens new window) | Prompts the user for input and validates it. |
render() (opens new window) | Renders a view and applies layout if available. |
renderContent() (opens new window) | Renders a static string by applying a layout. |
renderFile() (opens new window) | Renders a view file. |
renderPartial() (opens new window) | Renders a view without applying layout. |
run() (opens new window) | Runs a request specified in terms of a route. |
runAction() (opens new window) | Runs an action within this controller with the specified action ID and parameters. |
select() (opens new window) | Gives the user an option to choose from. Giving '?' as an input will show a list of options to choose from and their explanations. |
setView() (opens new window) | Sets the view object to be used by this controller. |
setViewPath() (opens new window) | Sets the directory that contains the view files. |
stderr() (opens new window) | Prints a string to STDERR. |
stdout() | Prints a string to STDOUT. |
stdoutlast() | |
success() (opens new window) | Outputs a success message to the console. |
table() (opens new window) | Outputs a table via craft\helpers\Console::table() (opens new window). |
tip() (opens new window) | Outputs a tip to the console. |
trigger() (opens new window) | Triggers an event. |
warning() (opens new window) | Outputs a warning to the console. |
writeJson() (opens new window) | JSON-encodes a value and writes it to a file. |
writeToFile() (opens new window) | Writes contents to a file, and outputs to the console. |
# _migrateCustomers()
Migrates all guest customers to users. Prepares and cleans up before and after this process.
View source (opens new window)
Returns
void
# _migrateDiscountUses()
View source (opens new window)
Returns
void
# _migrateOrderHistoryUser()
View source (opens new window)
Returns
void
# actionRun()
Runs the data migration
View source (opens new window)
Throws
# init()
View source (opens new window)
Returns
void
Throws
# isRunning()
View source (opens new window)
# stdout()
Prints a string to STDOUT.
You may optionally format the string with ANSI codes by passing additional parameters using the constants defined in yii\helpers\Console (opens new window).
Example:
$this->stdout('This will be red and underlined.', Console::FG_RED, Console::UNDERLINE);
View source (opens new window)
Arguments
$string
(string (opens new window)) – The string to print
Returns
integer (opens new window), boolean (opens new window) – Number of bytes printed or false on error
# stdoutlast()
View source (opens new window)
Arguments
$string
# Protected Methods
Method | Description |
---|---|
bindInjectedParams() (opens new window) | Fills parameters based on types and names in action method signature. |
checkRootUser() (opens new window) | Returns whether a command should be executed depending on whether it's being run as a root user, and whether they're OK with that. |
checkTty() (opens new window) | Sets yii\console\Controller::$interactive (opens new window) to false if this isn’t a TTY shell. |
createAttributeValidator() (opens new window) | Creates a function for the validator option of Controller::prompt . |
defineActions() (opens new window) | Returns an array of custom actions that should be available on the controller. |
getActionMethodReflection() (opens new window) | |
outputCommand() (opens new window) | |
parseDocCommentDetail() (opens new window) | Returns full description from the docblock. |
parseDocCommentSummary() (opens new window) | Returns the first line of docblock. |
parseDocCommentTags() (opens new window) | Parses the comment block into tags. |
# Constants
Constant | Description |
---|---|
EXIT_CODE_ERROR | |
EXIT_CODE_NORMAL |