Version: current

# Interface DataObjectInterface

DataObjectInterface is an interface that other data systems in your application can implement in order to behave in a manner similar to DataObject.

In addition to the methods defined below, the data of the object should be directly accessible as fields.

### Direct known implementers

`DataObject`

### Indirect known implementers

`AdditionalMenuWidget`, `AdditionalMenuWidget_Item`, `BaseObjectCategory`, `Image_Cached`, `Import1CLog`, `Import1CLog_File`, `Import1CLog_Item`, `Import1CLog_Task`, `ImportCatalog1C_PriceType`, `ImportCatalog1C_ProductProp`, `LoginAttempt`, `LogItem`, `MapObject`, `BookingAdminPage`, `MapObjectGroup`, `MapPage`, `Material3D_File`, `MediawebPage`, `MediawebPage_File`, `MediawebPage_Image`, `MediawebPage_Photo`, `Member`, `MemberPassword`, `Monument`, `BookingOrder`, `MonumentCatalog`, `MonumentForm`, `MonumentGalleryItem`, `MonumentPhotoGallery`, `MP3`, `NewsArchive`, `NewsEntry`, `NewsHolder`, `NewsHomepageWidget`, `Newsletter`, `BookingOrder_StatusLog`, `Newsletter_Recipient`, `Newsletter_SentRecipient`, `NewsletterEmailBlacklist`, `NewsletterType`, `NewsSidebarWidget`, `Notification`, `Order`, `Order_StatusLog`, `OrderDataObject`, `OrderItem`, `BookingPage`, `OrderService`, `OrderServiceOrder`, `Page`, `PageComment`, `PageMenuWidget`, `Payment`, `PaymentMethod`, `PaymentType`, `PayPalPayment`, `Permission`, `BookingPaymentMethod`, `PermissionRole`, `PermissionRoleCode`, `Person`, `PhotoAlbumHomepageWidget`, `PhotoAlbumItem`, `PhotoAlbumPage`, `PhotoGalleryHomepageWidget`, `PhotoGalleryHomepageWidget_Item`, `PhotoGalleryPage`, `PhotoGalleryWidget`, `BookingService`, `Polishing`, `Poll`, `PollAnswer`, `PollSidebarWidget`, `PortraitType`, `PriceListWidget`, `Product`, `ProductImportLog`, `ProductImportLog_Item`, `ProductParam`, `ButtonsBlockHomepageWidget`, `ProductParamValue`, `ProductSearchPage`, `ProductVariation`, `ProfilePage`, `PublHolder`, `Publication`, `PublicationWidget`, `QueuedEmail`, `RatePeriod`, `RatingDataObject`, `ButtonsBlockHomepageWidget_Item`, `RealtyImportLog`, `RealtyImportLog_Item`, `RedirectEntry`, `RedirectorPage`, `RegionRestriction`, `RegistrationPage`, `RelatedPageLink`, `Room`, `RoomCatalog`, `RoomOrder`, `CallBackWidget`, `RoomOrderPerson`, `RoomRate`, `RoomService`, `RoomServiceOrder`, `SberbankPayment`, `SearchWidget`, `SeparateHomepageWidget`, `SeparateSidebarWidget`, `ServiceOrder`, `ShippingMethod`, `Address`, `CarouselHomepageWidget`, `SidebarWidget`, `SidebarWidgetArea`, `SimpleOrderData`, `SimpleOrderForm`, `SimpleOrderPage`, `SiteConfig`, `SiteTree`, `SliderHomepageWidget`, `SliderHomepageWidget_Item`, `Socle`, `CarouselHomepageWidget_Item`, `SocleSection`, `SocleSize`, `SpecialCatalog`, `SpecialCatalogHomepageWidget`, `SpecialCatalogSidebarWidget`, `StartCatalog`, `SubmittedFileField`, `SubmittedForm`, `SubmittedFormField`, `SubscribeForm`, `CartPage`, `SubscribeWidget`, `SubsectionMenuWidget`, `Subsite`, `Subsite_Template`, `SubsiteDomain`, `SubsitesSelectorPage`, `SubsitesVirtualPage`, `TableShippingMethod`, `TableShippingRate`, `TextAnonsWidget`, `CartWidget`, `TextAnonsWidget_Item`, `TextBlockHomepageWidget`, `TextBlockSidebarWidget`, `Texture3D_File`, `UnitellerPayment`, `UnsubscribeRecord`, `UserDefinedForm`, `UserDefinedForm_EmailRecipient`, `VAT`, `VideoBankPage`, `Catalog`, `VideoCategory`, `VideoEntry`, `VideoFile`, `VirtualPage`, `VirtualProduct`, `VKNotificationQueue`, `WeatherSidebarWidget`, `WebylonWidget`, `WebylonWidget_Item`, `WebylonWidgetArea`, `CatalogFilter`, `WeightTableShippingMethod`, `WeightTableShippingRate`, `Widget`, `WidgetArea`, `YaMoneyPayment`, `YandexMapsHomepageWidget`, `YandexMapsWidget`, `CatalogFilterSidebarWidget`, `CatalogRubricsHomepageWidget`, `CheckoutPage`, `ChequePayment`, `AdvancedSliderHomepageWidget`, `ConsultantWidget`, `ContactsBlockWidget`, `ContactsPage`, `CostTableShippingMethod`, `CostTableShippingRate`, `CurrencyWidget`, `CustomMenuHolder`, `CustomMenuItem`, `CustomPayment`, `DataObjectFileTracking`, `AdvancedSliderHomepageWidget_Item`, `DocPage`, `DocumentDirection`, `DocumentHaving`, `DocumentItem`, `DocumentPage_File`, `DocumentsPage`, `DocumentType`, `EditableCheckbox`, `EditableCheckboxGroupField`, `EditableCountryDropdownField`, `Announcement`, `EditableDateField`, `EditableDateTimeField`, `EditableDropdown`, `EditableEmailField`, `EditableFileField`, `EditableFormField`, `EditableFormHeading`, `EditableHiddenField`, `EditableLiteralField`, `EditableMemberListField`, `AnnouncementHolder`, `EditableMultipleOptionField`, `EditableNumericField`, `EditableOption`, `EditablePhoneField`, `EditableRadioField`, `EditableSiteAgreementField`, `EditableSpamProtectionField`, `EditableTextField`, `EditableTimeField`, `Email_BounceRecord`, `AuthFormWidget`, `Epitaph`, `ErrorPage`, `Event`, `EventCalendarWidget`, `EventHolder`, `FaqHolder`, `FAQHomepageWidget`, `FaqQuestion`, `FaqSection`, `FAQSidebarWidget`, `BannerWidget`, `FavoritePage`, `FavoriteProductsSidebarWidget`, `FeedbackHomepageWidget`, `File`, `FixedShippingMethod`, `FlowerGarden`, `FlowerGarden_Size`, `FLV`, `Folder`, `Group`, `BannerWidget_Item`, `Guestbook`, `GuestbookEntry`, `GuestbookWidget`, `HomePage`, `HomepageWidget`, `HomepageWidgetArea`, `HouseCatalogSearchWidget`, `HTMLBlockHomepageWidget`, `HTMLBlockSidebarWidget`, `Image`

Package: sapphire\model
Located at sapphire/core/model/DataObjectInterface.php

## Methods summary

`public` | # `__construct( )` Create a new data object, not yet in the database. To load an object into the database, a null object should be constructed, its fields set, and the write() method called. Create a new data object, not yet in the database. To load an object into the database, a null object should be constructed, its fields set, and the write() method called.
`public` | # `instance_get( mixed $filter = "", mixed $sort = "", mixed $join = "", mixed $limit = "", mixed $containerClass = "DataObjectSet" )` Perform a search query on this data source Perform a search query on this data source #### Parameters $filter $filter A filter expression of some kind, in SQL format. $sort $sort A sort expression, in SQL format. $join $join A join expression. May or may not be relevant. $limit $limit A limit expression, either "(count)", or "(start), (count)" $containerClass
`public` | # `instance_get_one( mixed $filter, mixed $sort = "" )` Retrieve a single record from this data source Retrieve a single record from this data source #### Parameters $filter $filter A filter expression of some kind, in SQL format. $sort $sort A sort expression, in SQL format.
`public` | # `write( )` Write the current object back to the database. It should know whether this is a new object, in which case this would be an insert command, or if this is an existing object queried from the database, in which case thes would be Write the current object back to the database. It should know whether this is a new object, in which case this would be an insert command, or if this is an existing object queried from the database, in which case thes would be
`public` | # `delete( )` Remove this object from the database. Doesn't do anything if this object isn't in the database. Remove this object from the database. Doesn't do anything if this object isn't in the database.
`public` | # `__get( mixed $fieldName )` Get the named field. This function is sometimes called explicitly by the form system, so you need to define it, even if you use the default field system. Get the named field. This function is sometimes called explicitly by the form system, so you need to define it, even if you use the default field system.
`public` | # `setCastedField( mixed $fieldName, mixed $val )` Save content from a form into a field on this data object. Since the data comes straight from a form it can't be trusted and will need to be validated / escaped.' Save content from a form into a field on this data object. Since the data comes straight from a form it can't be trusted and will need to be validated / escaped.'

### Magic methods summary

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -