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