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

Property Description
env string (opens new window), null (opens new window) – The environment ID Craft is currently running in.
minVersionRequired string (opens new window), null (opens new window) – The minimum Craft build number required to update to this build.
schemaVersion string (opens new window), null (opens new window) – Craft’s schema version number.

# 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)

# minVersionRequired

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

The minimum Craft build number required to update to this build.

View source (opens new window)

# schemaVersion

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

Craft’s schema version number.

View source (opens new window)

# Public Methods

Method Description
disableMaintenanceMode() Disables Maintenance Mode.
enableMaintenanceMode() Enables Maintenance Mode.
getApi() Returns the API service.
getAssetIndexer() Returns the asset indexing service.
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.
getDeprecator() Returns the deprecator service.
getDrafts() Returns the drafts service.
getEdition() Returns 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.
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.
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.
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.
getVolumes() Returns the volumes 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:

View source (opens new window)

Returns

boolean (opens new window)

# enableMaintenanceMode()

Enables Maintenance Mode.

See also:

View source (opens new window)

Returns

boolean (opens new window)

# 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

# getAssetTransforms()

Returns the asset transforms service.

View source (opens new window)

Returns

craft\services\AssetTransforms – The asset transforms service

# 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

boolean (opens new window)

# getCanUpgradeEdition()

Returns whether Craft is eligible to be upgraded to a different edition.

View source (opens new window)

Returns

boolean (opens new window)

# 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

# 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

# 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

# getEdition()

Returns the Craft edition.

View source (opens new window)

Returns

integer (opens new window)

# getEditionName()

Returns the name of the Craft edition.

View source (opens new window)

Returns

string (opens new window)

# getElementIndexes()

Returns the element indexes service.

View source (opens new window)

Returns

craft\services\ElementIndexes – 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

# getEntryRevisions()

DEPRECATED

Deprecated in 3.2.0.

Returns the entry revisions service.

View source (opens new window)

Returns

craft\services\EntryRevisions – The entry revisions service

# getFeeds()

DEPRECATED

Deprecated in 3.4.24

Returns the feeds service.

View source (opens new window)

Returns

craft\feeds\Feeds – The feeds service

# getFields()

Returns the fields service.

View source (opens new window)

Returns

craft\services\Fields – The fields 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

boolean (opens new window)

# 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

Returns

craft\models\Info

Throws

# getInstalledSchemaVersion()

Since
3.2.0

Returns the installed schema version.

View source (opens new window)

Returns

string (opens new window)

# getIsInMaintenanceMode()

Returns whether someone is currently performing a system update.

See also:

View source (opens new window)

Returns

boolean (opens new window)

# getIsInitialized()

Since
3.0.13

Returns whether Craft has been fully initialized.

View source (opens new window)

Returns

boolean (opens new window)

# getIsInstalled()

Returns whether Craft is installed.

View source (opens new window)

Arguments

Returns

boolean (opens new window)

# getIsLive()

Since
3.1.0

Returns whether the system is currently live.

View source (opens new window)

Returns

boolean (opens new window)

# getIsMultiSite()

Returns whether this Craft install has multiple sites.

View source (opens new window)

Arguments

Returns

boolean (opens new window)

# getIsSystemOn()

DEPRECATED

Deprecated in 3.1.0. Use getIsLive() instead.

Returns whether the system is currently live.

View source (opens new window)

Returns

boolean (opens new window)

# 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

craft\queue\Queue, craft\queue\QueueInterface – 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

# 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

string (opens new window)

# getSystemSettings()

Returns the system settings service.

View source (opens new window)

Returns

craft\services\SystemSettings – The system settings service

# 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

Returns

string (opens new window)

# 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

# getVolumes()

Returns the volumes service.

View source (opens new window)

Returns

craft\services\Volumes – The volumes service

# getYiiVersion()

Returns the Yii framework version.

View source (opens new window)

Returns

string (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

Throws

# saveInfo()

Updates the info row.

View source (opens new window)

Arguments

Returns

boolean (opens new window)

# 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

Returns

boolean (opens new window)

# setIsInstalled()

Sets Craft's record of whether it's installed

View source (opens new window)

Arguments

# updateTargetLanguage()

Sets the target application language.

View source (opens new window)

Arguments