ApplicationTrait
- Type
- Trait
- Namespace
- craft\base
- Implemented by
- craft\console\Application, craft\web\Application
- Since
- 3.0.0
ApplicationTrait
View source (opens new window)
# Public Properties
# addresses
- Type
- craft\services\Addresses
- Default value
null
The addresses service
View source (opens new window)
# announcements
- Type
- craft\services\Announcements
- Default value
null
The announcements service
View source (opens new window)
# api
- Type
- craft\services\Api
- Default value
null
The API service
View source (opens new window)
# assetIndexer
- Type
- craft\services\AssetIndexer
- Default value
null
The asset indexer service
View source (opens new window)
# assetManager
- Type
- craft\web\AssetManager
- Default value
null
The asset manager component
View source (opens new window)
# assets
- Type
- craft\services\Assets
- Default value
null
The assets service
View source (opens new window)
# canTestEditions
- Type
- boolean (opens new window)
- Default value
null
Whether Craft is running on a domain that is eligible to test out the editions
View source (opens new window)
# canUpgradeEdition
- Type
- boolean (opens new window)
- Default value
null
Whether Craft is eligible to be upgraded to a different edition
View source (opens new window)
# categories
- Type
- craft\services\Categories
- Default value
null
The categories service
View source (opens new window)
# composer
- Type
- craft\services\Composer
- Default value
null
The Composer service
View source (opens new window)
# conditions
- Type
- craft\services\Conditions
- Default value
null
The conditions service
View source (opens new window)
# config
- Type
- craft\services\Config
- Default value
null
The config service
View source (opens new window)
# content
- Type
- craft\services\Content
- Default value
null
The content service
View source (opens new window)
# contentMigrator
- Type
- craft\db\MigrationManager
- Default value
null
The content migration manager
View source (opens new window)
# dashboard
- Type
- craft\services\Dashboard
- Default value
null
The dashboard service
View source (opens new window)
# db
- Type
- craft\db\Connection
- Default value
null
The database connection component
View source (opens new window)
# deprecator
- Type
- craft\services\Deprecator
- Default value
null
The deprecator service
View source (opens new window)
# drafts
- Type
- craft\services\Drafts
- Default value
null
The drafts service
View source (opens new window)
# edition
- Type
- integer (opens new window)
- Default value
null
The active Craft edition
View source (opens new window)
# elementSources
- Type
- craft\services\ElementSources
- Default value
null
The element sources service
View source (opens new window)
# elements
- Type
- craft\services\Elements
- Default value
null
The elements service
View source (opens new window)
# entries
- Type
- craft\services\Entries
- Default value
null
The entries service
View source (opens new window)
# env
- Type
- string (opens new window), null (opens new window)
- Default value
null
The environment ID Craft is currently running in.
View source (opens new window)
# fields
- Type
- craft\services\Fields
- Default value
null
The fields service
View source (opens new window)
# formatter
- Type
- craft\i18n\Formatter
- Default value
null
The formatter component
View source (opens new window)
# formattingLocale
- Type
- craft\i18n\Locale
- Default value
null
The Locale object that should be used to define the formatter
View source (opens new window)
# fs
- Type
- craft\services\Fs
- Default value
null
The filesystems service
View source (opens new window)
# gc
- Type
- craft\services\Gc
- Default value
null
The garbage collection service
View source (opens new window)
# globals
- Type
- craft\services\Globals
- Default value
null
The globals service
View source (opens new window)
# gql
- Type
- craft\services\Gql
- Default value
null
The GraphQl service
View source (opens new window)
# hasWrongEdition
- Type
- boolean (opens new window)
- Default value
null
Whether Craft is running with the wrong edition
View source (opens new window)
# i18n
- Type
- craft\i18n\I18N
- Default value
null
The internationalization (i18n) component
View source (opens new window)
# imageTransforms
- Type
- craft\services\ImageTransforms
- Default value
null
The image transforms service
View source (opens new window)
# images
- Type
- craft\services\Images
- Default value
null
The images service
View source (opens new window)
# installedSchemaVersion
- Type
- string (opens new window)
- Default value
null
The installed schema version
View source (opens new window)
# isInMaintenanceMode
- Type
- boolean (opens new window)
- Default value
null
Whether someone is currently performing a system update
View source (opens new window)
# isInitialized
- Type
- boolean (opens new window)
- Default value
null
Whether Craft is fully initialized
View source (opens new window)
# isInstalled
- Type
- boolean (opens new window)
- Default value
null
Whether Craft is installed
View source (opens new window)
# isMultiSite
- Type
- boolean (opens new window)
- Default value
null
Whether this site has multiple sites
View source (opens new window)
# isSystemLive
- Type
- boolean (opens new window)
- Default value
null
Whether the system is live
View source (opens new window)
# locale
- Type
- craft\i18n\Locale
- Default value
null
The Locale object for the target language
View source (opens new window)
# mailer
- Type
- craft\mail\Mailer
- Default value
null
The mailer component
View source (opens new window)
# matrix
- Type
- craft\services\Matrix
- Default value
null
The matrix service
View source (opens new window)
# migrator
- Type
- craft\db\MigrationManager
- Default value
null
The application’s migration manager
View source (opens new window)
# minVersionRequired
- Type
- string (opens new window)
- Default value
null
The minimum Craft build number required to update to this build.
View source (opens new window)
# mutex
- Type
- yii\mutex\Mutex (opens new window)
- Default value
null
The application’s mutex service
View source (opens new window)
# path
- Type
- craft\services\Path
- Default value
null
The path service
View source (opens new window)
# pluginStore
- Type
- craft\services\PluginStore
- Default value
null
The plugin store service
View source (opens new window)
# plugins
- Type
- craft\services\Plugins
- Default value
null
The plugins service
View source (opens new window)
# projectConfig
- Type
- craft\services\ProjectConfig
- Default value
null
The project config service
View source (opens new window)
# queue
- Type
- yii\queue\Queue (opens new window), craft\queue\QueueInterface
- Default value
null
The job queue
View source (opens new window)
# relations
- Type
- craft\services\Relations
- Default value
null
The relations service
View source (opens new window)
# revisions
- Type
- craft\services\Revisions
- Default value
null
The revisions service
View source (opens new window)
# routes
- Type
- craft\services\Routes
- Default value
null
The routes service
View source (opens new window)
# schemaVersion
- Type
- string (opens new window)
- Default value
null
Craft’s schema version number.
View source (opens new window)
# search
- Type
- craft\services\Search
- Default value
null
The search service
View source (opens new window)
# sections
- Type
- craft\services\Sections
- Default value
null
The sections service
View source (opens new window)
# security
- Type
- craft\services\Security
- Default value
null
The security component
View source (opens new window)
# sites
- Type
- craft\services\Sites
- Default value
null
The sites service
View source (opens new window)
# structures
- Type
- craft\services\Structures
- Default value
null
The structures service
View source (opens new window)
# systemMessages
- Type
- craft\services\SystemMessages
- Default value
null
The system email messages service
View source (opens new window)
# tags
- Type
- craft\services\Tags
- Default value
null
The tags service
View source (opens new window)
# templateCaches
- Type
- craft\services\TemplateCaches
- Default value
null
The template caches service
View source (opens new window)
# tokens
- Type
- craft\services\Tokens
- Default value
null
The tokens service
View source (opens new window)
# updates
- Type
- craft\services\Updates
- Default value
null
The updates service
View source (opens new window)
# userGroups
- Type
- craft\services\UserGroups
- Default value
null
The user groups service
View source (opens new window)
# userPermissions
- Type
- craft\services\UserPermissions
- Default value
null
The user permissions service
View source (opens new window)
# users
- Type
- craft\services\Users
- Default value
null
The users service
View source (opens new window)
# utilities
- Type
- craft\services\Utilities
- Default value
null
The utilities service
View source (opens new window)
# view
- Type
- craft\web\View
- Default value
null
The view component
View source (opens new window)
# volumes
- Type
- craft\services\Volumes
- Default value
null
The volumes service
View source (opens new window)
# webpack
- Type
- craft\services\Webpack
- Default value
null
The webpack service
View source (opens new window)
# Public Methods
Method | Description |
---|---|
disableMaintenanceMode() | Disables Maintenance Mode. |
enableMaintenanceMode() | Enables Maintenance Mode. |
getAddresses() | Returns the addresses service. |
getAnnouncements() | Returns the announcements service. |
getApi() | Returns the API service. |
getAssetIndexer() | Returns the asset indexing service. |
getAssetManager() | Returns the asset manager component. |
getAssets() | Returns the assets service. |
getCanTestEditions() | Returns whether Craft is running on a domain that is eligible to test out the editions. |
getCanUpgradeEdition() | Returns whether Craft is eligible to be upgraded to a different edition. |
getCategories() | Returns the categories service. |
getComposer() | Returns the Composer service. |
getConditions() | Returns the conditions service. |
getConfig() | Returns the config service. |
getContent() | Returns the content service. |
getContentMigrator() | Returns the content migration manager. |
getDashboard() | Returns the dashboard service. |
getDb() | Returns the database connection component. |
getDeprecator() | Returns the deprecator service. |
getDrafts() | Returns the drafts service. |
getDumper() | Returns the variable dumper. |
getEdition() | Returns the Craft edition. |
getEditionHandle() | Returns the handle of the Craft edition. |
getEditionName() | Returns the name of the Craft edition. |
getElementSources() | Returns the element indexes service. |
getElements() | Returns the elements service. |
getEntries() | Returns the entries service. |
getFields() | Returns the fields service. |
getFormatter() | Returns the formatter component. |
getFormattingLocale() | Returns the locale that should be used to define the formatter. |
getFs() | Returns the filesystems service. |
getGc() | Returns the garbage collection service. |
getGlobals() | Returns the globals service. |
getGql() | Returns the GraphQL service. |
getHasWrongEdition() | Returns whether Craft is running with the wrong edition. |
getI18n() | Returns the internationalization (i18n) component. |
getImageTransforms() | Returns the image transforms service. |
getImages() | Returns the images service. |
getInfo() | Returns the info model, or just a particular attribute. |
getInstalledSchemaVersion() | Returns the installed schema version. |
getIsInMaintenanceMode() | Returns whether someone is currently performing a system update. |
getIsInitialized() | Returns whether Craft has been fully initialized. |
getIsInstalled() | Returns whether Craft is installed. |
getIsLive() | Returns whether the system is currently live. |
getIsMultiSite() | Returns whether this Craft install has multiple sites. |
getLicensedEdition() | Returns the edition Craft is actually licensed to run in. |
getLicensedEditionName() | Returns the name of the edition Craft is actually licensed to run in. |
getLocale() | Returns a Locale object for the target language. |
getMailer() | Returns the current mailer. |
getMatrix() | Returns the matrix service. |
getMigrator() | Returns the application’s migration manager. |
getMutex() | Returns the application’s mutex service. |
getPath() | Returns the path service. |
getPluginStore() | Returns the plugin store service. |
getPlugins() | Returns the plugins service. |
getProjectConfig() | Returns the system config service. |
getQueue() | Returns the queue service. |
getRelations() | Returns the relations service. |
getRevisions() | Returns the revisions service. |
getRoutes() | Returns the routes service. |
getSearch() | Returns the search service. |
getSections() | Returns the sections service. |
getSecurity() | Returns the security component. |
getSites() | Returns the sites service. |
getStructures() | Returns the structures service. |
getSystemMessages() | Returns the system email messages service. |
getSystemName() | Returns the system name. |
getSystemUid() | Returns the system's UID. |
getTags() | Returns the tags service. |
getTargetLanguage() | Returns the target app language. |
getTemplateCaches() | Returns the template cache service. |
getTokens() | Returns the tokens service. |
getUpdates() | Returns the updates service. |
getUserGroups() | Returns the user groups service. |
getUserPermissions() | Returns the user permissions service. |
getUsers() | Returns the users service. |
getUtilities() | Returns the utilities service. |
getView() | Returns the view component. |
getVolumes() | Returns the volumes service. |
getWebpack() | Returns the webpack service. |
getYiiVersion() | Returns the Yii framework version. |
onInit() | Invokes a callback method when Craft is fully initialized. |
requireEdition() | Requires that Craft is running an equal or better edition than what's passed in |
saveInfo() | Updates the info row. |
saveInfoAfterRequest() | Updates the info row at the end of the request. |
setEdition() | Sets the Craft edition. |
setIsInstalled() | Sets Craft's record of whether it's installed |
setVendorPath() | Sets the directory that stores vendor files. |
updateTargetLanguage() | Sets the target application language. |
# disableMaintenanceMode()
Disables Maintenance Mode.
See also:
View source (opens new window)
Returns
# enableMaintenanceMode()
Enables Maintenance Mode.
See also:
View source (opens new window)
Returns
# getAddresses()
- Since
- 4.0.0
Returns the addresses service.
View source (opens new window)
Returns
craft\services\Addresses – The addresses service
# getAnnouncements()
- Since
- 3.7.0
Returns the announcements service.
View source (opens new window)
Returns
craft\services\Announcements – The announcements service
# getApi()
Returns the API service.
View source (opens new window)
Returns
craft\services\Api – The API service
# getAssetIndexer()
Returns the asset indexing service.
View source (opens new window)
Returns
craft\services\AssetIndexer – The asset indexing service
# getAssetManager()
Returns the asset manager component.
View source (opens new window)
Returns
# getAssets()
Returns the assets service.
View source (opens new window)
Returns
craft\services\Assets – The assets service
# getCanTestEditions()
Returns whether Craft is running on a domain that is eligible to test out the editions.
View source (opens new window)
Returns
# getCanUpgradeEdition()
Returns whether Craft is eligible to be upgraded to a different edition.
View source (opens new window)
Returns
# getCategories()
Returns the categories service.
View source (opens new window)
Returns
craft\services\Categories – The categories service
# getComposer()
Returns the Composer service.
View source (opens new window)
Returns
craft\services\Composer – The Composer service
# getConditions()
- Since
- 4.0.0
Returns the conditions service.
View source (opens new window)
Returns
craft\services\Conditions – The conditions service
# getConfig()
Returns the config service.
View source (opens new window)
Returns
craft\services\Config – The config service
# getContent()
Returns the content service.
View source (opens new window)
Returns
craft\services\Content – The content service
# getContentMigrator()
Returns the content migration manager.
View source (opens new window)
Returns
craft\db\MigrationManager – The content migration manager
# getDashboard()
Returns the dashboard service.
View source (opens new window)
Returns
craft\services\Dashboard – The dashboard service
# getDb()
Returns the database connection component.
View source (opens new window)
Returns
# getDeprecator()
Returns the deprecator service.
View source (opens new window)
Returns
craft\services\Deprecator – The deprecator service
# getDrafts()
- Since
- 3.2.0
Returns the drafts service.
View source (opens new window)
Returns
craft\services\Drafts – The drafts service
# getDumper()
- Since
- 4.4.2
Returns the variable dumper.
View source (opens new window)
Returns
\Symfony\Component\VarDumper\Dumper\AbstractDumper
# getEdition()
Returns the Craft edition.
View source (opens new window)
Returns
# getEditionHandle()
- Since
- 4.4.0
Returns the handle of the Craft edition.
View source (opens new window)
Returns
# getEditionName()
Returns the name of the Craft edition.
View source (opens new window)
Returns
# getElementSources()
Returns the element indexes service.
View source (opens new window)
Returns
craft\services\ElementSources – The element indexes service
# getElements()
Returns the elements service.
View source (opens new window)
Returns
craft\services\Elements – The elements service
# getEntries()
Returns the entries service.
View source (opens new window)
Returns
craft\services\Entries – The entries service
# getFields()
Returns the fields service.
View source (opens new window)
Returns
craft\services\Fields – The fields service
# getFormatter()
Returns the formatter component.
View source (opens new window)
Returns
# getFormattingLocale()
- Since
- 3.6.0
Returns the locale that should be used to define the formatter.
View source (opens new window)
Returns
# getFs()
- Since
- 4.0.0
Returns the filesystems service.
View source (opens new window)
Returns
craft\services\Fs – The filesystems service
# getGc()
Returns the garbage collection service.
View source (opens new window)
Returns
craft\services\Gc – The garbage collection service
# getGlobals()
Returns the globals service.
View source (opens new window)
Returns
craft\services\Globals – The globals service
# getGql()
- Since
- 3.3.0
Returns the GraphQL service.
View source (opens new window)
Returns
craft\services\Gql – The GraphQL service
# getHasWrongEdition()
Returns whether Craft is running with the wrong edition.
View source (opens new window)
Returns
# getI18n()
Returns the internationalization (i18n) component.
View source (opens new window)
Returns
# getImageTransforms()
Returns the image transforms service.
View source (opens new window)
Returns
craft\services\ImageTransforms – The asset transforms service
# getImages()
Returns the images service.
View source (opens new window)
Returns
craft\services\Images – The images service
# getInfo()
Returns the info model, or just a particular attribute.
View source (opens new window)
Arguments
$throwException
(boolean (opens new window)) – Whether an exception should be thrown if theinfo
table doesn't exist
Returns
Throws
- yii\db\Exception (opens new window)
if theinfo
table doesn’t exist yet and$throwException
istrue
- yii\web\ServerErrorHttpException (opens new window)
if the info table is missing its row
# getInstalledSchemaVersion()
DEPRECATED
Deprecated in 4.0.0
- Since
- 3.2.0
Returns the installed schema version.
View source (opens new window)
Returns
# getIsInMaintenanceMode()
Returns whether someone is currently performing a system update.
See also:
View source (opens new window)
Returns
# getIsInitialized()
- Since
- 3.0.13
Returns whether Craft has been fully initialized.
View source (opens new window)
Returns
# getIsInstalled()
Returns whether Craft is installed.
View source (opens new window)
Arguments
$strict
(boolean (opens new window)) – Whether to ignore the cached value and explicitly check from the default schema.
Returns
# getIsLive()
- Since
- 3.1.0
Returns whether the system is currently live.
View source (opens new window)
Returns
# getIsMultiSite()
Returns whether this Craft install has multiple sites.
View source (opens new window)
Arguments
$refresh
(boolean (opens new window)) – Whether to ignore the cached result and check again$withTrashed
(boolean (opens new window)) – Whether to factor in soft-deleted sites
Returns
# getLicensedEdition()
Returns the edition Craft is actually licensed to run in.
View source (opens new window)
Returns
integer (opens new window), null (opens new window)
# getLicensedEditionName()
Returns the name of the edition Craft is actually licensed to run in.
View source (opens new window)
Returns
string (opens new window), null (opens new window)
# getLocale()
Returns a Locale object for the target language.
View source (opens new window)
Returns
craft\i18n\Locale – The Locale object for the target language
# getMailer()
Returns the current mailer.
View source (opens new window)
Returns
craft\mail\Mailer – The mailer component
# getMatrix()
Returns the matrix service.
View source (opens new window)
Returns
craft\services\Matrix – The matrix service
# getMigrator()
Returns the application’s migration manager.
View source (opens new window)
Returns
craft\db\MigrationManager – The application’s migration manager
# getMutex()
Returns the application’s mutex service.
View source (opens new window)
Returns
yii\mutex\Mutex (opens new window) – The application’s mutex service
# getPath()
Returns the path service.
View source (opens new window)
Returns
craft\services\Path – The path service
# getPluginStore()
Returns the plugin store service.
View source (opens new window)
Returns
craft\services\PluginStore – The plugin store service
# getPlugins()
Returns the plugins service.
View source (opens new window)
Returns
craft\services\Plugins – The plugins service
# getProjectConfig()
Returns the system config service.
View source (opens new window)
Returns
craft\services\ProjectConfig – The system config service
# getQueue()
Returns the queue service.
View source (opens new window)
Returns
yii\queue\Queue (opens new window) – The queue service
# getRelations()
Returns the relations service.
View source (opens new window)
Returns
craft\services\Relations – The relations service
# getRevisions()
- Since
- 3.2.0
Returns the revisions service.
View source (opens new window)
Returns
craft\services\Revisions – The revisions service
# getRoutes()
Returns the routes service.
View source (opens new window)
Returns
craft\services\Routes – The routes service
# getSearch()
Returns the search service.
View source (opens new window)
Returns
craft\services\Search – The search service
# getSections()
Returns the sections service.
View source (opens new window)
Returns
craft\services\Sections – The sections service
# getSecurity()
Returns the security component.
View source (opens new window)
Returns
# getSites()
Returns the sites service.
View source (opens new window)
Returns
craft\services\Sites – The sites service
# getStructures()
Returns the structures service.
View source (opens new window)
Returns
craft\services\Structures – The structures service
# getSystemMessages()
Returns the system email messages service.
View source (opens new window)
Returns
craft\services\SystemMessages – The system email messages service
# getSystemName()
- Since
- 3.1.4
Returns the system name.
View source (opens new window)
Returns
# getSystemUid()
Returns the system's UID.
View source (opens new window)
Returns
string (opens new window), null (opens new window)
# getTags()
Returns the tags service.
View source (opens new window)
Returns
craft\services\Tags – The tags service
# getTargetLanguage()
Returns the target app language.
View source (opens new window)
Arguments
$useUserLanguage
(boolean (opens new window)) – Whether the user’s preferred language should be used.
Returns
# getTemplateCaches()
Returns the template cache service.
View source (opens new window)
Returns
craft\services\TemplateCaches – The template caches service
# getTokens()
Returns the tokens service.
View source (opens new window)
Returns
craft\services\Tokens – The tokens service
# getUpdates()
Returns the updates service.
View source (opens new window)
Returns
craft\services\Updates – The updates service
# getUserGroups()
Returns the user groups service.
View source (opens new window)
Returns
craft\services\UserGroups – The user groups service
# getUserPermissions()
Returns the user permissions service.
View source (opens new window)
Returns
craft\services\UserPermissions – The user permissions service
# getUsers()
Returns the users service.
View source (opens new window)
Returns
craft\services\Users – The users service
# getUtilities()
Returns the utilities service.
View source (opens new window)
Returns
craft\services\Utilities – The utilities service
# getView()
Returns the view component.
View source (opens new window)
Returns
# getVolumes()
Returns the volumes service.
View source (opens new window)
Returns
craft\services\Volumes – The volumes service
# getWebpack()
- Since
- 3.7.22
Returns the webpack service.
View source (opens new window)
Returns
craft\services\Webpack – The volumes service
# getYiiVersion()
Returns the Yii framework version.
View source (opens new window)
Returns
# onInit()
- Since
- 4.3.5
Invokes a callback method when Craft is fully initialized.
If Craft is already fully initialized, the callback will be invoked immediately.
View source (opens new window)
Arguments
$callback
(callable (opens new window))
# requireEdition()
Requires that Craft is running an equal or better edition than what's passed in
View source (opens new window)
Arguments
$edition
(integer (opens new window)) – The Craft edition to require.$orBetter
(boolean (opens new window)) – If true, makes $edition the minimum edition required.
Throws
- craft\errors\WrongEditionException
if attempting to do something not allowed by the current Craft edition
# saveInfo()
Updates the info row.
View source (opens new window)
Arguments
$info
(craft\models\Info)$attributeNames
(string (opens new window)[], null (opens new window)) – The attributes to save
Returns
# saveInfoAfterRequest()
- Since
- 3.1.33
Updates the info row at the end of the request.
View source (opens new window)
# setEdition()
Sets the Craft edition.
View source (opens new window)
Arguments
$edition
(integer (opens new window)) – The edition to set.
Returns
# setIsInstalled()
Sets Craft's record of whether it's installed
View source (opens new window)
Arguments
# setVendorPath()
Sets the directory that stores vendor files.
View source (opens new window)
Arguments
$path
(string (opens new window)) – The directory that stores vendor files.
# updateTargetLanguage()
Sets the target application language.
View source (opens new window)
Arguments
$useUserLanguage
(boolean (opens new window), null (opens new window)) – Whether the user’s preferred language should be used. If null, the user’s preferred language will be used if this is a control panel request or a console request.