ResaveController

Type
Class
Namespace
craft\console\controllers
Inherits
craft\console\controllers\ResaveController » craft\console\Controller » 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
Since
3.1.15

Allows you to bulk-save elements.

View source (opens new window)

# Public Properties

Property Description
action (opens new window) yii\base\Action (opens new window) – The action that is currently being executed.
behaviors (opens new window) yii\base\Behavior (opens new window) – List of behaviors attached to this component
color (opens new window) boolean (opens new window) – Whether to enable ANSI color in the output.
defaultAction (opens new window) string (opens new window) – The ID of the action that is used when the action ID is not specified in the request.
elementId integer (opens new window), string (opens new window) – The ID(s) of the elements to resave.
field string (opens new window), null (opens new window) – The field handle to save Matrix blocks for.
group string (opens new window), null (opens new window) – The group handle(s) to save categories/tags/users from.
help (opens new window) boolean (opens new window) – Whether to display help information about current command.
helpSummary (opens new window) string (opens new window)
id (opens new window) string (opens new window) – The ID of this controller.
interactive (opens new window) boolean (opens new window) – Whether to run the command interactively.
layout (opens new window) null (opens new window), string (opens new window), false (opens new window) – The name of the layout to be applied to this controller's views.
limit integer (opens new window), null (opens new window) – The number of elements to resave.
module (opens new window) yii\base\Module (opens new window) – The module that this controller belongs to.
modules (opens new window) yii\base\Module (opens new window) – All ancestor modules that this controller is located within.
offset integer (opens new window), null (opens new window) – The number of elements to skip.
passedOptionValues (opens new window) array (opens new window) – The properties corresponding to the passed options
passedOptions (opens new window) array (opens new window) – The names of the options passed during execution
propagate boolean (opens new window) – Whether to save the elements across all their enabled sites.
request (opens new window) yii\base\Request (opens new window), array (opens new window), string (opens new window) – The request.
response (opens new window) yii\base\Response (opens new window), array (opens new window), string (opens new window) – The response.
route (opens new window) string (opens new window) – The route (module ID, controller ID and action ID) of the current request.
section string (opens new window), null (opens new window) – The section handle(s) to save entries from.
silentExitOnException (opens new window) boolean (opens new window) – If true - script finish with ExitCode::OK in case of exception.
site string (opens new window), null (opens new window) – The site handle to save elements from.
status string (opens new window) – The status(es) of elements to resave.
type string (opens new window), null (opens new window) – The type handle(s) of the elements to resave.
uid string (opens new window) – The UUID(s) of the elements to resave.
uniqueId (opens new window) string (opens new window) – The controller ID that is prefixed with the module ID (if any).
updateSearchIndex boolean (opens new window) – Whether to update the search indexes for the resaved elements.
view (opens new window) yii\base\View (opens new window), yii\web\View (opens new window) – The view object that can be used to render views or view files.
viewPath (opens new window) string (opens new window) – The directory containing the view files for this controller.
volume string (opens new window), null (opens new window) – The volume handle(s) to save assets from.

# elementId

Type
integer (opens new window), string (opens new window)
Default value
null

The ID(s) of the elements to resave.

View source (opens new window)

# field

Type
string (opens new window), null (opens new window)
Default value
null

The field handle to save Matrix blocks for.

View source (opens new window)

# group

Type
string (opens new window), null (opens new window)
Default value
null

The group handle(s) to save categories/tags/users from. Can be set to multiple comma-separated groups.

View source (opens new window)

# limit

Type
integer (opens new window), null (opens new window)
Default value
null

The number of elements to resave.

View source (opens new window)

# offset

Type
integer (opens new window), null (opens new window)
Default value
null

The number of elements to skip.

View source (opens new window)

# propagate

Type
boolean (opens new window)
Default value
true

Whether to save the elements across all their enabled sites.

View source (opens new window)

# section

Type
string (opens new window), null (opens new window)
Default value
null

The section handle(s) to save entries from. Can be set to multiple comma-separated sections.

View source (opens new window)

# site

Type
string (opens new window), null (opens new window)
Default value
null

The site handle to save elements from.

View source (opens new window)

# status

Type
string (opens new window)
Default value
'any'

The status(es) of elements to resave. Can be set to multiple comma-separated statuses.

View source (opens new window)

# type

Type
string (opens new window), null (opens new window)
Default value
null
Since
3.1.16

The type handle(s) of the elements to resave.

View source (opens new window)

# uid

Type
string (opens new window)
Default value
null

The UUID(s) of the elements to resave.

View source (opens new window)

# updateSearchIndex

Type
boolean (opens new window)
Default value
false

Whether to update the search indexes for the resaved elements.

View source (opens new window)

# volume

Type
string (opens new window), null (opens new window)
Default value
null

The volume handle(s) to save assets from. Can be set to multiple comma-separated volumes.

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) Constructor.
__get() Returns the value of a component property.
__isset() Checks if a property is set, i.e. defined and not null.
__set() Sets the value of a component property.
__unset() (opens new window) Sets an object property to null.
actionAssets() Re-saves assets.
actionCategories() Re-saves categories.
actionEntries() Re-saves entries.
actionMatrixBlocks() Re-saves Matrix blocks.
actionTags() Re-saves tags.
actionUsers() Re-saves users.
actions() 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.
detachBehavior() (opens new window) Detaches a behavior from the component.
detachBehaviors() (opens new window) Detaches all behaviors from the component.
ensureBehaviors() (opens new window) Makes sure that the behaviors declared in behaviors() (opens new window) are attached to this component.
findLayoutFile() (opens new window) Finds the applicable layout file.
getActionArgsHelp() Returns the help information for the anonymous arguments for the action.
getActionHelp() Returns the detailed help information for the specified action.
getActionHelpSummary() Returns a one-line short summary describing the specified action.
getActionOptionsHelp() 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.
init() Initializes the object.
isColorEnabled() (opens new window) Returns a value indicating whether ANSI color is enabled.
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() Returns the names of valid options for the action (id) An option requires the existence of a public member variable whose name is the option name.
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() Runs an action with the specified action ID and parameters.
saveElements()
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() (opens new window) Prints a string to STDOUT.
trigger() (opens new window) Triggers an event.

# actionAssets()

Re-saves assets.

View source (opens new window)

Returns

integer (opens new window)

# actionCategories()

Re-saves categories.

View source (opens new window)

Returns

integer (opens new window)

# actionEntries()

Re-saves entries.

View source (opens new window)

Returns

integer (opens new window)

# actionMatrixBlocks()

Since
3.2.0

Re-saves Matrix blocks.

Note that you must supply the --field or --element-id argument for this to work properly.

View source (opens new window)

Returns

integer (opens new window)

# actionTags()

Re-saves tags.

View source (opens new window)

Returns

integer (opens new window)

# actionUsers()

Re-saves users.

View source (opens new window)

Returns

integer (opens new window)

# options()

Returns the names of valid options for the action (id) An option requires the existence of a public member variable whose name is the option name.

Child classes may override this method to specify possible options.

Note that the values setting via options are not available until beforeAction() (opens new window) is being called.

View source (opens new window)

Arguments

Returns

string (opens new window)[] – The names of the options valid for the action

# saveElements()

Since
3.2.0

View source (opens new window)

Arguments

Returns

integer (opens new window)

# Protected Methods

Method Description
bindInjectedParams() (opens new window) Fills parameters based on types and names in action method signature.
defineActions() Returns an array of custom actions that should be available on the controller.
getActionMethodReflection()
outputCommand()
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