Skip to content

ModelInterface ​

Type
Interface
Namespace
craft\base
Extends
ArrayAccess, IteratorAggregate, yii\base\Arrayable, yii\base\StaticInstanceInterface
Implemented by
craft\assetpreviews\Image, craft\assetpreviews\Pdf, craft\assetpreviews\Text, craft\assetpreviews\Video, craft\auth\methods\BaseAuthMethod, craft\auth\methods\RecoveryCodes, craft\auth\methods\TOTP, craft\auth\sso\BaseExternalProvider, craft\auth\sso\BaseProvider, craft\auth\sso\CraftProvider, craft\auth\sso\mapper\ExplicitUserMapper, craft\auth\sso\mapper\IdpAttributeUserMapper, craft\auth\sso\mapper\TemplateValueUserMapper, craft\base\AssetPreviewHandler, craft\base\Component, craft\base\ComponentInterface, craft\base\ConfigurableComponent, craft\base\Element, craft\base\ElementAction, craft\base\ElementExporter, craft\base\Field, craft\base\FieldLayoutComponent, craft\base\FieldLayoutElement, craft\base\Fs, craft\base\Model, craft\base\SavableComponent, craft\base\Utility, craft\base\Widget, craft\base\conditions\BaseCondition, craft\base\conditions\BaseConditionRule, craft\base\conditions\BaseDateRangeConditionRule, craft\base\conditions\BaseElementSelectConditionRule, craft\base\conditions\BaseLightswitchConditionRule, craft\base\conditions\BaseMultiSelectConditionRule, craft\base\conditions\BaseNumberConditionRule, craft\base\conditions\BaseSelectConditionRule, craft\base\conditions\BaseTextConditionRule, craft\config\BaseConfig, craft\config\DbConfig, craft\config\GeneralConfig, craft\elements\Address, craft\elements\Asset, craft\elements\Category, craft\elements\Entry, craft\elements\GlobalSet, craft\elements\Tag, craft\elements\User, craft\elements\actions\ChangeSortOrder, craft\elements\actions\CopyReferenceTag, craft\elements\actions\CopyUrl, craft\elements\actions\Delete, craft\elements\actions\DeleteAssets, craft\elements\actions\DeleteForSite, craft\elements\actions\DeleteUsers, craft\elements\actions\DownloadAssetFile, craft\elements\actions\Duplicate, craft\elements\actions\Edit, craft\elements\actions\EditImage, craft\elements\actions\MoveAssets, craft\elements\actions\MoveToSection, craft\elements\actions\NewChild, craft\elements\actions\NewSiblingAfter, craft\elements\actions\NewSiblingBefore, craft\elements\actions\PreviewAsset, craft\elements\actions\RenameFile, craft\elements\actions\ReplaceFile, craft\elements\actions\Restore, craft\elements\actions\SetStatus, craft\elements\actions\ShowInFolder, craft\elements\actions\SuspendUsers, craft\elements\actions\UnsuspendUsers, craft\elements\actions\View, craft\elements\conditions\DateCreatedConditionRule, craft\elements\conditions\DateUpdatedConditionRule, craft\elements\conditions\ElementCondition, craft\elements\conditions\HasDescendantsRule, craft\elements\conditions\HasUrlConditionRule, craft\elements\conditions\IdConditionRule, craft\elements\conditions\LevelConditionRule, craft\elements\conditions\NotRelatedToConditionRule, craft\elements\conditions\RelatedToConditionRule, craft\elements\conditions\SiteConditionRule, craft\elements\conditions\SiteGroupConditionRule, craft\elements\conditions\SlugConditionRule, craft\elements\conditions\StatusConditionRule, craft\elements\conditions\TitleConditionRule, craft\elements\conditions\UriConditionRule, craft\elements\conditions\addresses\AddressCondition, craft\elements\conditions\addresses\AddressLine1ConditionRule, craft\elements\conditions\addresses\AddressLine2ConditionRule, craft\elements\conditions\addresses\AddressLine3ConditionRule, craft\elements\conditions\addresses\AdministrativeAreaConditionRule, craft\elements\conditions\addresses\CountryConditionRule, craft\elements\conditions\addresses\DependentLocalityConditionRule, craft\elements\conditions\addresses\FullNameConditionRule, craft\elements\conditions\addresses\LocalityConditionRule, craft\elements\conditions\addresses\OrganizationConditionRule, craft\elements\conditions\addresses\OrganizationTaxIdConditionRule, craft\elements\conditions\addresses\PostalCodeConditionRule, craft\elements\conditions\addresses\SortingCodeConditionRule, craft\elements\conditions\assets\AssetCondition, craft\elements\conditions\assets\DateModifiedConditionRule, craft\elements\conditions\assets\FileSizeConditionRule, craft\elements\conditions\assets\FileTypeConditionRule, craft\elements\conditions\assets\FilenameConditionRule, craft\elements\conditions\assets\HasAltConditionRule, craft\elements\conditions\assets\HeightConditionRule, craft\elements\conditions\assets\SavableConditionRule, craft\elements\conditions\assets\UploaderConditionRule, craft\elements\conditions\assets\ViewableConditionRule, craft\elements\conditions\assets\VolumeConditionRule, craft\elements\conditions\assets\WidthConditionRule, craft\elements\conditions\categories\CategoryCondition, craft\elements\conditions\categories\GroupConditionRule, craft\elements\conditions\entries\AuthorConditionRule, craft\elements\conditions\entries\AuthorGroupConditionRule, craft\elements\conditions\entries\EntryCondition, craft\elements\conditions\entries\ExpiryDateConditionRule, craft\elements\conditions\entries\MatrixFieldConditionRule, craft\elements\conditions\entries\PostDateConditionRule, craft\elements\conditions\entries\SavableConditionRule, craft\elements\conditions\entries\SectionConditionRule, craft\elements\conditions\entries\TypeConditionRule, craft\elements\conditions\entries\ViewableConditionRule, craft\elements\conditions\tags\GroupConditionRule, craft\elements\conditions\tags\TagCondition, craft\elements\conditions\users\AdminConditionRule, craft\elements\conditions\users\CredentialedConditionRule, craft\elements\conditions\users\EmailConditionRule, craft\elements\conditions\users\FirstNameConditionRule, craft\elements\conditions\users\GroupConditionRule, craft\elements\conditions\users\LastLoginDateConditionRule, craft\elements\conditions\users\LastNameConditionRule, craft\elements\conditions\users\UserCondition, craft\elements\conditions\users\UsernameConditionRule, craft\elements\exporters\Expanded, craft\elements\exporters\Raw, craft\fieldlayoutelements\BaseField, craft\fieldlayoutelements\BaseNativeField, craft\fieldlayoutelements\BaseUiElement, craft\fieldlayoutelements\CustomField, craft\fieldlayoutelements\FullNameField, craft\fieldlayoutelements\Heading, craft\fieldlayoutelements\HorizontalRule, craft\fieldlayoutelements\Html, craft\fieldlayoutelements\LineBreak, craft\fieldlayoutelements\Template, craft\fieldlayoutelements\TextField, craft\fieldlayoutelements\TextareaField, craft\fieldlayoutelements\Tip, craft\fieldlayoutelements\TitleField, craft\fieldlayoutelements\addresses\AddressField, craft\fieldlayoutelements\addresses\CountryCodeField, craft\fieldlayoutelements\addresses\LabelField, craft\fieldlayoutelements\addresses\LatLongField, craft\fieldlayoutelements\addresses\OrganizationField, craft\fieldlayoutelements\addresses\OrganizationTaxIdField, craft\fieldlayoutelements\assets\AltField, craft\fieldlayoutelements\assets\AssetTitleField, craft\fieldlayoutelements\entries\EntryTitleField, craft\fieldlayoutelements\users\EmailField, craft\fieldlayoutelements\users\FullNameField, craft\fieldlayoutelements\users\PhotoField, craft\fieldlayoutelements\users\UsernameField, craft\fields\Addresses, craft\fields\Assets, craft\fields\BaseOptionsField, craft\fields\BaseRelationField, craft\fields\Categories, craft\fields\Checkboxes, craft\fields\Color, craft\fields\Country, craft\fields\Date, craft\fields\Dropdown, craft\fields\Email, craft\fields\Entries, craft\fields\Icon, craft\fields\Lightswitch, craft\fields\Link, craft\fields\Matrix, craft\fields\MissingField, craft\fields\Money, craft\fields\MultiSelect, craft\fields\Number, craft\fields\PlainText, craft\fields\RadioButtons, craft\fields\Table, craft\fields\Tags, craft\fields\Time, craft\fields\Users, craft\fields\conditions\CountryFieldConditionRule, craft\fields\conditions\DateFieldConditionRule, craft\fields\conditions\EmptyFieldConditionRule, craft\fields\conditions\LightswitchFieldConditionRule, craft\fields\conditions\MoneyFieldConditionRule, craft\fields\conditions\NumberFieldConditionRule, craft\fields\conditions\OptionsFieldConditionRule, craft\fields\conditions\RelationalFieldConditionRule, craft\fields\conditions\TextFieldConditionRule, craft\fields\linktypes\Asset, craft\fields\linktypes\BaseElementLinkType, craft\fields\linktypes\BaseLinkType, craft\fields\linktypes\BaseTextLinkType, craft\fields\linktypes\Category, craft\fields\linktypes\Email, craft\fields\linktypes\Entry, craft\fields\linktypes\Phone, craft\fields\linktypes\Url, craft\fs\Local, craft\fs\MissingFs, craft\fs\Temp, craft\gql\ArgumentManager, craft\gql\ElementQueryConditionBuilder, craft\gql\TypeManager, craft\gql\base\ElementMutationResolver, craft\gql\base\MutationResolver, craft\gql\resolvers\mutations\Asset, craft\gql\resolvers\mutations\Category, craft\gql\resolvers\mutations\Entry, craft\gql\resolvers\mutations\GlobalSet, craft\gql\resolvers\mutations\Tag, craft\imagetransforms\FallbackTransformer, craft\imagetransforms\ImageTransformer, craft\mail\transportadapters\BaseTransportAdapter, craft\mail\transportadapters\Gmail, craft\mail\transportadapters\Sendmail, craft\mail\transportadapters\Smtp, craft\models\AssetIndexData, craft\models\AssetIndexingSession, craft\models\CategoryGroup, craft\models\CategoryGroup_SiteSettings, craft\models\CraftIdToken, craft\models\CraftSupport, craft\models\DeprecationError, craft\models\EntryType, craft\models\FieldLayout, craft\models\FieldLayoutForm, craft\models\FieldLayoutFormTab, craft\models\FieldLayoutTab, craft\models\FolderCriteria, craft\models\FsListing, craft\models\GqlSchema, craft\models\GqlToken, craft\models\ImageTransform, craft\models\ImageTransformIndex, craft\models\Info, craft\models\MailSettings, craft\models\ProjectConfigData, craft\models\ReadOnlyProjectConfigData, craft\models\Section, craft\models\Section_SiteSettings, craft\models\Site, craft\models\SiteGroup, craft\models\Structure, craft\models\SystemMessage, craft\models\TagGroup, craft\models\Update, craft\models\UpdateRelease, craft\models\Updates, craft\models\Url, craft\models\UserGroup, craft\models\Volume, craft\models\VolumeFolder, craft\test\EventItem, craft\test\console\CommandTestItem, craft\test\mockclasses\components\ComponentExample, craft\test\mockclasses\components\DependencyHeavyComponentExample, craft\test\mockclasses\components\EventTriggeringComponent, craft\test\mockclasses\components\ExtendedComponentExample, craft\test\mockclasses\elements\ExampleElement, craft\test\mockclasses\models\ExampleModel, craft\utilities\AssetIndexes, craft\utilities\ClearCaches, craft\utilities\DbBackup, craft\utilities\DeprecationErrors, craft\utilities\FindAndReplace, craft\utilities\Migrations, craft\utilities\PhpInfo, craft\utilities\ProjectConfig, craft\utilities\QueueManager, craft\utilities\SystemMessages, craft\utilities\SystemReport, craft\utilities\Updates, craft\utilities\Upgrade, craft\widgets\CraftSupport, craft\widgets\Feed, craft\widgets\MissingWidget, craft\widgets\MyDrafts, craft\widgets\NewUsers, craft\widgets\QuickPost, craft\widgets\RecentEntries, craft\widgets\Updates
Since
4.0.0

ModelInterface defines the common interface to be implemented by Craft model classes.

A class implementing this interface should extend craft\base\Model.

View source

Public Methods ​

MethodDescription
extraFields()Returns the list of additional fields that can be returned by toArray() in addition to those listed in fields().
fields()Returns the list of fields that should be returned by default by toArray() when no specific fields are specified.
instance()Returns static class instance, which can be used to obtain meta information.
toArray()Converts the object into an array.