Webylon 3.2 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • 1c
    • exchange
      • catalog
  • auth
  • Booking
  • building
    • company
  • cart
    • shipping
    • steppedcheckout
  • Catalog
    • monument
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • Aggregate
  • Aggregate_Relationship
  • AssetAdminQuotaExtension
  • AttachedFilesExtension
  • BookingWidget
  • ClassInfo
  • ControllerRedirectExtension
  • CSSContentParser
  • DisableJSValidation
  • Extension
  • HtmlEditorQuotaExtension
  • ManifestBuilder
  • MobileExtension
  • Object
  • PaymentMethodAutoHide
  • ProductSearchFormExtension
  • SS_Cache
  • TokenisedRegularExpression
  • ValidationResult
  • WebylonSiteSearchExtension
  • YamlFixture

Functions

  • __autoload
  • _t
  • array_fill_keys
  • getClassFile
  • getSysTempDir
  • getTempFolder
  • increase_memory_limit_to
  • increase_time_limit_to
  • project
  • singleton
  • stripslashes_recursively
  • translate_memstring

Class Object

A base class for all sapphire objects to inherit from.

This class provides a number of pattern implementations, as well as methods and fixes to add extra psuedo-static and method functionality to PHP.

See Extension on how to implement a custom multiple inheritance for object instances based on PHP5 method call overloading.

Direct known subclasses

Archive, Authenticator, Filesystem, FormScaffolder, FormTransformation, GD, i18n, i18nTextCollector, Mailer, Notifications, PasswordValidator, SearchContext, BatchProcess, SearchFilter, SilverStripeNavigatorItem, SQLFormatter, SQLMap, SQLMap_Iterator, SS_Cli, TextParser, TokenisedRegularExpression, ValidationResult, Validator, BuildTask, ViewableData, XML, YamlFixture, BulkLoader_Result, Cart, CSSContentParser, CSVParser, DataFormatter, DataObjectLog

Indirect known subclasses

AdditionalMenuWidget, AdditionalMenuWidget_Item, Announcement, CsvBulkLoader, Currency, CurrencyField, CurrencyField_Disabled, CurrencyField_Readonly, CurrencyWidget, CustomMenuAdmin, CustomMenuHolder, CustomMenuItem, CustomPayment, Announcement_Controller, CustomRequiredFields, DailyTask, DashboardAdmin, DashboardPlugin, DatabaseAdmin, DataDifferencer, DatalessField, DataObject, DataObjectFileTracking, DataObjectManager, AnnouncementHolder, DataObjectManager_Controller, DataObjectManager_Item, DataObjectManager_ItemRequest, DataObjectManager_Popup, DataObjectManagerAction, DataObjectSet, Date, DateField, DateField_Disabled, DatePickerField, AnnouncementHolder_Controller, DatePickerField_Controller, DatetimeField, DatetimeField_Readonly, DBField, DBLocale, Decimal, DeleteEmptyAssociatedFoldersTask, DeleteUnconfirmTask, DeleteUnusedCustomerFilesTask, DevelopmentAdmin, ArrayData, DisabledTransformation, DocPage, DocPage_Controller, DocumentDirection, DocumentHaving, DocumentItem, DocumentPage_File, DocumentPageFiles_Manager, DocumentSearchForm, DocumentsPage, AssetAdmin, DocumentsPage_Controller, DocumentType, Double, DropdownField, EditableCheckbox, EditableCheckboxGroupField, EditableCountryDropdownField, EditableDateField, EditableDateTimeField, EditableDropdown, AssetManager, EditableEmailField, EditableFileField, EditableFormField, EditableFormHeading, EditableHiddenField, EditableLiteralField, EditableMemberListField, EditableMultipleOptionField, EditableNumericField, EditableOption, AssetTableField, EditablePhoneField, EditableRadioField, EditableSiteAgreementField, EditableSpamProtectionField, EditableTextField, EditableTimeField, Email, Email_BounceHandler, Email_BounceRecord, EmailField, AuthFormWidget, EncryptAllPasswordsTask, EndsWithFilter, Enum, Epitaph, ErrorPage, ErrorPage_Controller, Event, Event_Controller, EventCalendarWidget, EventHolder, AutoCompleteField, EventHolder_Controller, ExactMatchFilter, ExactMatchFilterWithEmpty, ExactMatchMultiFilter, FaqAdmin, FaqHolder, FaqHolder_Controller, FAQHomepageWidget, FaqQuestion, FaqSection, Address, AutocompleteTextField, FaqSection_Controller, FAQSidebarWidget, FavoritePage, FavoritePage_Controller, FavoriteProductsSidebarWidget, FeedbackHomepageWidget, FieldEditor, FieldGroup, FieldSet, File, BannerWidget, FileComplexTableField, FileDataObjectManager, FileDataObjectManager_Controller, FileDataObjectManager_Item, FileDataObjectManager_ItemRequest, FileDataObjectManager_Popup, FileField, FileIFrameField, FileList, FilesystemSyncTask, BannerWidget_Item, FillLinkTrackingTask, FillOldLogDataTask, FillTechTitleTask, FindBadLinksTask, FindCyrillic, FindCyrillic_Controller, FixedShippingMethod, Float, FlowerGarden, FlowerGarden_Size, BaseObjectCategory, FlushGeneratedImagesTask, FLV, Folder, Folder_UnusedAssetsField, FolderRenameTask, ForeignKey, Form, Form_FieldMap, FormAction, FormAction_WithoutLabel, BatchProcess_Controller, FormEncodedDataFormatter, FormField, FulltextFilter, GoogleSitemap, GreaterThanFilter, Group, GroupCsvBulkLoader, GroupedDropdownField, GroupImportForm, Guestbook, BBCodeParser, Guestbook_Controller, GuestbookAdmin, GuestbookAdmin_CollectionController, GuestbookEntry, GuestbookWidget, HasManyComplexTableField, HasManyComplexTableField_Item, HasManyDataObjectManager, HasManyDataObjectManager_Item, HasManyFileDataObjectManager, BigFilesReport, HasManyFileDataObjectManager_Item, HasOneComplexTableField, HasOneComplexTableField_Item, HasOneDataObjectManager, HasOneDataObjectManager_Item, HasOneFileDataObjectManager, HasOneFileDataObjectManager_Item, HeaderField, HiddenField, HiddenFieldSet, BookingAdminPage, HomePage, HomePage_Controller, HomepageWidget, HomepageWidgetArea, HourlyTask, HouseCatalogGenerateProductParamsTask, HouseCatalogSearchWidget, HouseCatalogSearchWidget_Controller, HTMLBlockHomepageWidget, HTMLBlockSidebarWidget, BookingAdminPage_Controller, HTMLDropdownField, HtmlEditorField, HtmlEditorField_Readonly, HtmlEditorField_Toolbar, HTMLText, HTMLVarchar, i18nTextCollectorTask, Image, Image_Cached, ImageAssetManager, BookingOrder, ImageDataObjectManager, ImageDataObjectManager_Item, ImageDataObjectManager_ItemRequest, ImageDataObjectManager_Popup, ImageEditor, ImageField, ImageFormAction, ImageResizeTask, Import1C_Controller, Import1CLog, AddSubsiteTask, BookingOrder_StatusLog, Import1CLog_File, Import1CLog_Item, Import1CLog_Task, ImportCatalog1C_Controller, ImportCatalog1C_PriceType, ImportCatalog1C_ProcessTask, ImportCatalog1C_ProductProp, ImportCatalog1C_ProductProp_Admin, ImportTestContentTask, InlineFormAction, BookingOrderAdmin, InlineFormAction_ReadOnly, InstallerTest, Int, JSONDataFormatter, JSTestRunner, LabelField, LanguageDropdownField, LastDoc_Controller, LeftAndMain, LessThanFilter, BookingOrderAdmin_CollectionController, ListboxField, LiteralField, LiveCalendarWidget, LiveCalendarWidget_Controller, LoggerAdmin, LoggerAdmin_CollectionController, LoggerAdmin_RecordController, LoginAttempt, LoginForm, LogItem, BookingPage, LookupField, ManyManyComplexTableField, ManyManyComplexTableField_Item, ManyManyDataObjectManager, ManyManyDataObjectManager_Item, ManyManyFileDataObjectManager, ManyManyFileDataObjectManager_Item, MapObject, MapObject_Controller, MapObjectGroup, BookingPage_Controller, MapObjectGroup_Controller, MapPage, MapPage_Controller, Material3D_File, Mediaweb3DPageFiles_Manager, MediawebForm, MediawebPage, MediawebPage_Controller, MediawebPage_File, MediawebPage_Image, BookingPaymentMethod, MediawebPage_Photo, MediawebPage_Popup, MediawebPageFiles_Manager, MediawebPagePhoto_Manager, MediawebPageTexture_Manager, Member, Member_ChangePasswordEmail, Member_ForgotPasswordEmail, Member_GroupSet, Member_ProfileForm, BookingService, Member_SignupEmail, Member_Validator, MemberAuthenticator, MemberCsvBulkLoader, MemberImportForm, MemberLoginForm, MemberPassword, MemberTableField, MemberTableField_Item, MemberTableField_ItemRequest, Boolean, MemberTableField_Popup, MigrateSiteTreeLinkingTask, MigrateTranslatableTask, MigrationTask, ModelAdmin, ModelAdmin_CollectionController, ModelAdmin_RecordController, ModelAsController, ModelViewer, ModelViewer_Field, BouncedList, ModelViewer_Model, ModelViewer_Module, ModelViewer_Relation, Money, MoneyField, MonthlyTask, MonthNavigator, Monument, Monument_Controller, Monument_PolishingTextField, BrokenLinksReport, MonumentAdmin, MonumentCatalog, MonumentCatalog_Controller, MonumentForm, MonumentForm_Controller, MonumentGalleryItem, MonumentPhotoGallery, MP3, MultiEnum, MultiUploadControls, AdvancedSearchForm, BulkLoader, MultiUploadField, MyRangeField, NegationFilter, NestedForm, NewDocumentsAdmin, NewsArchive, NewsArchive_Controller, NewsEntry, NewsEntry_Controller, NewsHolder, ButtonsBlockHomepageWidget, NewsHolder_Controller, NewsHomepageWidget, Newsletter, Newsletter_Email, Newsletter_Recipient, Newsletter_SentRecipient, NewsletterAdmin, NewsletterEmailBlacklist, NewsletterEmailProcess, NewsletterList, ButtonsBlockHomepageWidget_Item, NewsletterType, NewsSidebarWidget, NonUsedFilesReport, Notification, NullableField, NumericField, NZGovtPasswordValidator, OptionsetField, Order, Order_CancelForm, CalendarWidget, Order_StatusLog, OrderAdmin, OrderAdmin_CollectionController, OrderAdmin_RecordController, OrderDataObject, OrderExporter, OrderItem, OrderItemField, Orders1CExchange_Controller, OrderService, CallBackWidget, OrderServiceOrder, Page, Page_Controller, PageComment, PageComment_Controller, PageCommentInterface, PageCommentInterface_Controller, PageCommentInterface_Form, PageMenuWidget, PartialMatchFilter, CarouselHomepageWidget, PasswordField, Payment, Payment_Handler, PaymentAdmin, PaymentAdmin_CollectionController, PaymentMethod, PaymentType, PayPalPayment, PayPalPayment_Handler, Percentage, CarouselHomepageWidget_Item, Permission, PermissionCheckboxSetField, PermissionCheckboxSetField_Readonly, PermissionRole, PermissionRoleCode, Person, PhoneField, PhoneNumberField, PhotoAlbumHomepageWidget, PhotoAlbumItem, Cart_Controller, PhotoAlbumManager, PhotoAlbumManager_Controller, PhotoAlbumManager_Popup, PhotoAlbumPage, PhotoAlbumPage_Controller, PhotoGalleryHomepageWidget, PhotoGalleryHomepageWidget_Item, PhotoGalleryMigrationTask, PhotoGalleryPage, PhotoGalleryPage_Controller, CartOrderButton, PhotoGalleryWidget, PhpCaptchaField, Polishing, Poll, PollAnswer, PollPage, PollSidebarWidget, PortraitType, PostVKNotificationQueueTask, PriceListWidget, CartPage, PrimaryKey, PrintableTransformation, PrintableTransformation_TabSet, Product, Product_Controller, ProductCatalogImportTask, ProductImport1CAdmin, ProductImport1CAdmin_CollectionController, ProductImportAdmin, ProductImportAdmin_CollectionController, AdvancedSliderHomepageWidget, CartPage_Controller, ProductImportLog, ProductImportLog_Item, ProductParam, ProductParamValue, ProductParamValue_BoolValueField, ProductParamValue_MultiValueField, ProductParamValue_MultiValueSetField, ProductParamValue_ValueField, ProductSearchPage, ProductSearchPage_Controller, CartTableListField, ProductVariation, ProfilePage, ProfilePage_Controller, ProgressBar, PublHolder, PublHolder_Controller, Publication, Publication_Controller, PublicationWidget, QuarterHourlyTask, CartTableListField_Item, QueuedEmail, QueuedEmailDispatchTask, RangeField, RatePeriod, RatingDataObject, RatingExtension_Controller, ReadonlyField, ReadonlyTransformation, RealtyImportAdmin, RealtyImportAdmin_CollectionController, CartWidget, RealtyImportLog, RealtyImportLog_Item, RealtyXMLImportTask, RebuildStaticCacheTask, RecentComments, RecentFiles, RecentPages, RecipientExportField, RecipientImportField, RecipientImportField_Cell, Catalog, RecipientImportField_UploadForm, RedirectEntry, RedirectEntry_Admin, RedirectorPage, RedirectorPage_Controller, RegionRestriction, RegistrationPage, RegistrationPage_Controller, RelatedPageLink, RemoveOrphanedPagesTask, Catalog_Controller, ReportAdmin, RequestHandler, RequiredFields, ResetFormAction, RestfulServer, RestfulService, RestrictedTextField, RestrictionRegionCountryDropdownField, Room, Room_Controller, CatalogAdmin, RoomCatalog, RoomCatalog_Controller, RoomOrder, RoomOrderPerson, RoomRate, RoomRate_PriceField, RoomService, RoomServiceAdmin, RoomServiceDropdownField, RoomServiceOrder, CatalogAdmin_CollectionController, RootURLController, RSSFeed, RSSFeed_Entry, SapphireInfo, SapphireREPL, SapphireSoapServer, SaveFileSizeTask, SberbankPayment, SberbankPayment_Handler, ScaffoldingComplexTableField_Popup, CatalogAdmin_RecordController, ScheduledTask, Search_Controller, SearchForm, SearchWidget, Security, SecurityAdmin, SelectionGroup, SeparateHomepageWidget, SeparateSidebarWidget, ServiceOrder, CatalogFilter, SetMainSiteHomePageTypeTask, ShippingMethod, ShippingMethodAdmin, ShippingMethodAdmin_CollectionController, ShopCountry, ShowPoll, SidebarWidget, SidebarWidgetArea, SideReport_BrokenFiles, SideReport_BrokenLinks, AdvancedSliderHomepageWidget_Item, CatalogFilterSidebarWidget, SideReport_BrokenRedirectorPages, SideReport_BrokenVirtualPages, SideReport_EmptyPages, SideReport_RecentlyEdited, SideReport_ToDo, SideReportView, SideReportWrapper, SilverStripeNavigatorItem_ArchiveLink, SilverStripeNavigatorItem_CMSLink, SilverStripeNavigatorItem_LiveLink, CatalogPrice, SilverStripeNavigatorItem_StageLink, SimpleHTMLEditorField, SimpleImageField, SimpleImageField_Disabled, SimpleOrderButton, SimpleOrderData, SimpleOrderForm, SimpleOrderForm_Controller, SimpleOrderPage, SimpleOrderPage_Controller, CatalogRubricsHomepageWidget, SimpleOrderPage_SubmittedFormEmail, SimpleTinyMCEField, SimpleTreeDropdownField, SimpleWysiwygField, SiteConfig, SiteInfo, SiteMap_Controller, SiteTree, SiteTreeMaintenanceTask, SliderHomepageWidget, ChangePasswordForm, SliderHomepageWidget_Item, SOAPModelAccess, Socle, Socle_Controller, SocleSection, SocleSize, SocleSize_Controller, SocleSize_SocleSectionTextField, SpamProtectorField, SpecialCatalog, CheckboxField, SpecialCatalog_Controller, SpecialCatalogHomepageWidget, SpecialCatalogSidebarWidget, SS_Datetime, SS_HTMLValue, SS_Report, SS_ReportWrapper, StartCatalog, StartCatalog_Controller, StartsWithFilter, CheckboxField_Disabled, StartsWithMultiFilter, StateDropdownField, StateProvinceDropdownField, StaticExporter, StealthFieldCaptcha, StringField, SubmittedFileField, SubmittedForm, SubmittedFormField, SubmittedFormReportField, CheckboxField_Readonly, SubpageListField, SubpageListField_Item, SubPageListField_ItemRequest, SubscribeForm, SubscribeForm_Controller, SubscribeWidget, SubsectionMenuWidget, Subsite, Subsite_Template, SubsiteAdmin, CheckboxSetField, SubsiteAdmin_CollectionController, SubsiteAgnosticTableListField, SubsiteDomain, SubsiteDropdownField, SubsiteReportWrapper, SubsitesSelectorPage, SubsitesSelectorPage_Controller, SubsitesTreeDropdownField, SubsitesVirtualPage, SubsitesVirtualPage_Controller, CheckoutPage, SubstringFilter, Tab, TableField, TableField_Item, TableListField, TableListField_Item, TableListField_ItemRequest, TableShippingMethod, TableShippingRate, TabSet, CheckoutPage_Controller, TabularStyle, TarballArchive, TaskRunner, TestMailer, TestRunner, TestViewer, Text, TextAnonsWidget, TextAnonsWidget_Item, TextareaField, Aggregate, ChequePayment, TextBlockHomepageWidget, TextBlockSidebarWidget, TextField, TextFieldWithEmptyFlag, TextLiteralField, Texture3D_File, ThumbnailStripField, Time, TimeField, TimeField_Readonly, ChequePayment_Handler, ToggleCompositeField, ToggleField, Translatable_Transformation, TreeDropdownField, TreeDropdownField_Readonly, TreeMultiselectField, TreeMultiselectField_Readonly, TreeSelectorField, UniqueRestrictedTextField, UniqueTextField, ClearHistoryTask, UnitellerPayment, UnitellerPayment_Handler, UnmoderatedComments, Unsubscribe_Controller, Unsubscribe_MailingListForm, UnsubscribedList, UnsubscribeRecord, UpgradeSiteTreePermissionSchemaTask, Upload, UserDefinedForm, CliController, UserDefinedForm_Controller, UserDefinedForm_EmailRecipient, UserDefinedForm_SubmittedFormEmail, UserFormsVersionedTask, Varchar, VAT, VAT_Admin, Versioned_Version, VersionedRestfulServer, VideoBankPage, CMSActionOptionsForm, VideoBankPage_Controller, VideoCategory, VideoEntry, VideoFile, VideoManager, ViewableData_Customised, ViewableData_Debugger, VirtualPage, VirtualPage_Controller, VirtualProduct, CMSBatchActionHandler, VirtualProduct_Controller, VKNotificationQueue, VKNotificationQueueAdmin, WeatherSidebarWidget, WebylonNews, WebylonWidget, WebylonWidget_Item, WebylonWidgetArea, WeeklyTask, WeightTableShippingMethod, CMSMain, WeightTableShippingRate, Widget, Widget_Controller, Widget_TreeDropdownField, WidgetAdmin, WidgetArea, WidgetAreaEditor, WithinRangeFilter, XMLDataFormatter, YaMoneyPayment, CodeViewer, YaMoneyPayment_Handler, YandexMapsHomepageWidget, YandexMapsWidget, Year, YearlyTask, YMLExporter, CommentAdmin, CommentTableField, Aggregate_Relationship, CommentTableField_Item, ComplexTableField, ComplexTableField_Item, ComplexTableField_ItemRequest, ComplexTableField_Popup, ComponentSet, CompositeField, ConfirmedPasswordField, ConsultantWidget, ContactsBlockWidget, AjaxUniqueTextField, ContactsPage, ContactsPage_Controller, ContentController, Controller, ConvertFrom26Task, CorrectBadFoldersTask, CostTableShippingMethod, CostTableShippingRate, CountryDropdownField, CreditCardField

Abstract
Package: sapphire\core
Located at sapphire/core/Object.php

Methods summary

public static Object
# create( mixed $arguments,… )

An implementation of the factory method, allows you to create an instance of a class

An implementation of the factory method, allows you to create an instance of a class

This method first for strong class overloads (singletons & DB interaction), then custom class overloads. If an overload is found, an instance of this is returned rather than the original class. To overload a class, use Object::useCustomClass()

Parameters

$arguments,…
mixed $arguments,... arguments to pass to the constructor

Returns

Object
Object
public static
# create_from_string( mixed $classSpec, mixed $firstArg = null )

Create an object from a string representation. It treats it as a PHP constructor without the 'new' keyword. It also manages to construct the object without the use of eval().

Create an object from a string representation. It treats it as a PHP constructor without the 'new' keyword. It also manages to construct the object without the use of eval().

Construction itself is done with Object::create(), so that Object::useCustomClass() calls are respected.

Object::create_from_string("Versioned('Stage','Live')") will return the result of Object::create('Versioned', 'Stage', 'Live);

It is designed for simple, clonable objects. The first time this method is called for a given string it is cached, and clones of that object are returned.

If you pass the $firstArg argument, this will be prepended to the constructor arguments. It's impossible to pass null as the firstArg argument.

Object::create_from_string("Varchar(50)", "MyField") will return the result of Object::create('Vachar', 'MyField', '50');

Arguments are always strings, although this is a quirk of the current implementation rather than something that can be relied upon.

public static
# parse_class_spec( mixed $classSpec )

Parses a class-spec, such as "Versioned('Stage','Live')", as passed to create_from_string(). Returns a 2-elemnent array, with classname and arguments

Parses a class-spec, such as "Versioned('Stage','Live')", as passed to create_from_string(). Returns a 2-elemnent array, with classname and arguments

public static Object
# strong_create( mixed $arguments,… )

Similar to Object::create(), except that classes are only overloaded if you set the $strong parameter to TRUE when using Object::useCustomClass()

Similar to Object::create(), except that classes are only overloaded if you set the $strong parameter to TRUE when using Object::useCustomClass()

Parameters

$arguments,…
mixed $arguments,... arguments to pass to the constructor

Returns

Object
Object

Used by

singleton()
public static
# useCustomClass( string $oldClass, string $newClass, boolean $strong = false )

This class allows you to overload classes with other classes when they are constructed using the factory method Object::create()

This class allows you to overload classes with other classes when they are constructed using the factory method Object::create()

Parameters

$oldClass
string $oldClass the class to replace
$newClass
string $newClass the class to replace it with
$strong
bool $strong allows you to enforce a certain class replacement under all circumstances. This is used in singletons and DB interaction classes
public static string
# getCustomClass( string $class )

If a class has been overloaded, get the class name it has been overloaded with - otherwise return the class name

If a class has been overloaded, get the class name it has been overloaded with - otherwise return the class name

Parameters

$class
string $class the class to check

Returns

string
the class that would be created if you called Object::create() with the class
public static mixed
# get_static( string $class, string $name, boolean $uncached = false )

Get a static variable, taking into account SS's inbuild static caches and pseudo-statics

Get a static variable, taking into account SS's inbuild static caches and pseudo-statics

This method first checks for any extra values added by Object::add_static_var(), and attemps to traverse up the extra static var chain until it reaches the top, or it reaches a replacement static.

If any extra values are discovered, they are then merged with the default PHP static values, or in some cases completely replace the default PHP static when you set $replace = true, and do not define extra data on any child classes

Note that from SilverStripe 2.3.2, Object::get_static() can only be used to get public static variables, not protected ones.

Parameters

$class
string $class
$name
string $name the property name
$uncached
bool $uncached if set to TRUE, force a regeneration of the static cache

Returns

mixed
mixed
public static
# set_static( string $class, string $name, mixed $value )

Set a static variable

Set a static variable

Parameters

$class
string $class
$name
string $name the property name to set
$value
mixed $value
public static mixed
# uninherited_static( string $class, string $name, mixed $uncached = false )

Get an uninherited static variable - a variable that is explicity set in this class, and not in the parent class.

Get an uninherited static variable - a variable that is explicity set in this class, and not in the parent class.

Note that from SilverStripe 2.3.2, Object::uninherited_static() can only be used to get public static variables, not protected ones.

Parameters

$class
string $class
$name
string $name
$uncached

Returns

mixed
mixed
public static mixed
# combined_static( string $class, string $name, string $ceiling = false )

Traverse down a class ancestry and attempt to merge all the uninherited static values for a particular static into a single variable

Traverse down a class ancestry and attempt to merge all the uninherited static values for a particular static into a single variable

Parameters

$class
string $class
$name
string $name the static name
$ceiling
string $ceiling an optional parent class name to begin merging statics down from, rather than traversing the entire hierarchy

Returns

mixed
mixed
public static
# addStaticVars( string $class, array $properties, boolean $replace = false )

Merge in a set of additional static variables

Merge in a set of additional static variables

Parameters

$class
string $class
$properties
array $properties in a [property name] => [value] format
$replace
bool $replace replace existing static vars
public static
# add_static_var( string $class, string $name, mixed $value, boolean $replace = false )

Add a static variable without replacing it completely if possible, but merging in with both existing PHP statics and existing psuedo-statics. Uses PHP's array_merge_recursive() with if the $replace argument is FALSE.

Add a static variable without replacing it completely if possible, but merging in with both existing PHP statics and existing psuedo-statics. Uses PHP's array_merge_recursive() with if the $replace argument is FALSE.

Documentation from http://php.net/array_merge_recursive: If the input arrays have the same string keys, then the values for these keys are merged together into an array, and this is done recursively, so that if one of the values is an array itself, the function will merge it with a corresponding entry in another array too. If, however, the arrays have the same numeric key, the later value will not overwrite the original value, but will be appended.

Parameters

$class
string $class
$name
string $name the static name
$value
mixed $value
$replace
bool $replace completely replace existing static values
public static
# has_extension( string $class, string $requiredExtension )

Return TRUE if a class has a specified extension

Return TRUE if a class has a specified extension

Parameters

$class
string $class
$requiredExtension
string $requiredExtension the class name of the extension to check for.
public static
# add_extension( string $class, string $extension )

Add an extension to a specific class. As an alternative, extensions can be added to a specific class directly in the Object::$extensions array. See SiteTree::$extensions for examples. Keep in mind that the extension will only be applied to new instances, not existing ones (including all instances created through singleton()).

Add an extension to a specific class. As an alternative, extensions can be added to a specific class directly in the Object::$extensions array. See SiteTree::$extensions for examples. Keep in mind that the extension will only be applied to new instances, not existing ones (including all instances created through singleton()).

Parameters

$class
string $class Class that should be decorated - has to be a subclass of Object
$extension
string $extension Subclass of Extension with optional parameters as a string, e.g. "Versioned" or "Translatable('Param')"
public static
# remove_extension( string $class, string $extension )

Remove an extension from a class. Keep in mind that this won't revert any datamodel additions of the extension at runtime, unless its used before the schema building kicks in (in your _config.php). Doesn't remove the extension from any Object instances which are already created, but will have an effect on new extensions. Clears any previously created singletons through singleton() to avoid side-effects from stale extension information.

Remove an extension from a class. Keep in mind that this won't revert any datamodel additions of the extension at runtime, unless its used before the schema building kicks in (in your _config.php). Doesn't remove the extension from any Object instances which are already created, but will have an effect on new extensions. Clears any previously created singletons through singleton() to avoid side-effects from stale extension information.

Parameters

$class
string $class
$extension
string $extension Classname of an Extension subclass, without parameters
public array
# get_extensions( string $class, boolean $includeArgumentString = false )

Parameters

$class
string $class
$includeArgumentString
bool $includeArgumentString Include the argument string in the return array, FALSE would return array("Versioned"), TRUE returns array("Versioned('Stage','Live')").

Returns

array
Numeric array of either DataObjectDecorator classnames, or eval'ed classname strings with constructor arguments.
public
# __construct( )
public
# __wakeup( )
public mixed
# __call( string $method, array $arguments )

Attemps to locate and call a method dynamically added to a class at runtime if a default cannot be located

Attemps to locate and call a method dynamically added to a class at runtime if a default cannot be located

You can add extra methods to a class using Extensions, Object::createMethod() or Object::addWrapperMethod()

Parameters

$method
string $method
$arguments
array $arguments

Returns

mixed
mixed
public boolean
# hasMethod( string $method )

Return TRUE if a method exists on this object

Return TRUE if a method exists on this object

This should be used rather than PHP's inbuild method_exists() as it takes into account methods added via extensions

Parameters

$method
string $method

Returns

boolean
bool
public array
# allMethodNames( boolean $custom = false )

Return the names of all the methods available on this object

Return the names of all the methods available on this object

Parameters

$custom
bool $custom include methods added dynamically at runtime

Returns

array
array
protected
# defineMethods( )

Adds any methods from Extension instances attached to this object. All these methods can then be called directly on the instance (transparently mapped through Object::__call()), or called explicitly through Object::extend().

Adds any methods from Extension instances attached to this object. All these methods can then be called directly on the instance (transparently mapped through Object::__call()), or called explicitly through Object::extend().

Uses

Object::addMethodsFrom()
protected
# addMethodsFrom( string $property, string|integer $index = null )

Add all the methods from an object property (which is an Extension) to this object.

Add all the methods from an object property (which is an Extension) to this object.

Parameters

$property
string $property the property name
$index
string|int $index an index to use if the property is an array

Used by

Object::defineMethods()
protected
# addWrapperMethod( string $method, string $wrap )

Add a wrapper method - a method which points to another method with a different name. For example, Thumbnail(x) can be wrapped to generateThumbnail(x)

Add a wrapper method - a method which points to another method with a different name. For example, Thumbnail(x) can be wrapped to generateThumbnail(x)

Parameters

$method
string $method the method name to wrap
$wrap
string $wrap the method name to wrap to
protected
# createMethod( string $method, string $code )

Add an extra method using raw PHP code passed as a string

Add an extra method using raw PHP code passed as a string

Parameters

$method
string $method the method name
$code
string $code the PHP code - arguments will be in an array called $args, while you can access this object by using $obj. Note that you cannot call protected methods, as the method is actually an external function
public
# stat( mixed $name, mixed $uncached = false )

See

Object::get_static()
public
# set_stat( mixed $name, mixed $value )

See

Object::set_static()
public
# uninherited( mixed $name )

See

Object::uninherited_static()
public
# set_uninherited( )

Deprecated

public boolean
# exists( )

Return true if this object "exists" i.e. has a sensible value

Return true if this object "exists" i.e. has a sensible value

This method should be overriden in subclasses to provide more context about the classes state. For example, a DataObject class could return false when it is deleted from the database

Returns

boolean
bool
public string
# parentClass( )

Returns

string
this classes parent class
public boolean
# is_a( string $class )

Check if this class is an instance of a specific class, or has that class as one of its parents

Check if this class is an instance of a specific class, or has that class as one of its parents

Parameters

$class
string $class

Returns

boolean
bool
public string
# __toString( )

Returns

string
the class name
public mixed
# invokeWithExtensions( string $method, mixed $argument = null )

Calls a method if available on both this object and all applied Extensions, and then attempts to merge all results into an array

Calls a method if available on both this object and all applied Extensions, and then attempts to merge all results into an array

Parameters

$method
string $method the method name to call
$argument
mixed $argument a single argument to pass

Returns

mixed
mixed
public array
# extend( string $method, mixed $a1,…, mixed & $a2 = null, mixed & $a3 = null, mixed & $a4 = null, mixed & $a5 = null, mixed & $a6 = null, mixed & $a7 = null )

Run the given function on all of this object's extensions. Note that this method originally returned void, so if you wanted to return results, you're hosed

Run the given function on all of this object's extensions. Note that this method originally returned void, so if you wanted to return results, you're hosed

Currently returns an array, with an index resulting every time the function is called. Only adds returns if they're not NULL, to avoid bogus results from methods just defined on the parent decorator. This is important for permission-checks through extend, as they use min() to determine if any of the returns is FALSE. As min() doesn't do type checking, an included NULL return would fail the permission checks.

The extension methods are defined during Object::__construct() in Object::defineMethods().

Parameters

$method
string $method the name of the method to call on each extension
$a1,…
mixed $a1,... up to 7 arguments to be passed to the method
$a2
$a3
$a4
$a5
$a6
$a7

Returns

array
array
public Extension
# getExtensionInstance( string $extension )

Get an extension instance attached to this object by name.

Get an extension instance attached to this object by name.

Parameters

$extension
string $extension

Returns

Extension
Extension

Uses

Object::hasExtension()
public boolean
# hasExtension( string $extension )

Returns TRUE if this object instance has a specific extension applied in Object::$extension_instances. Extension instances are initialized at constructor time, meaning if you use Object::add_extension() afterwards, the added extension will just be added to new instances of the decorated class. Use the static method Object::has_extension() to check if a class (not an instance) has a specific extension. Caution: Don't use singleton(<class>)->hasExtension() as it will give you inconsistent results based on when the singleton was first accessed.

Returns TRUE if this object instance has a specific extension applied in Object::$extension_instances. Extension instances are initialized at constructor time, meaning if you use Object::add_extension() afterwards, the added extension will just be added to new instances of the decorated class. Use the static method Object::has_extension() to check if a class (not an instance) has a specific extension. Caution: Don't use singleton(<class>)->hasExtension() as it will give you inconsistent results based on when the singleton was first accessed.

Parameters

$extension
string $extension Classname of an Extension subclass without parameters

Returns

boolean
bool

Used by

Object::getExtensionInstance()
public array
# getExtensionInstances( )

Get all extension instances for this specific object instance. See Object::get_extensions() to get all applied extension classes for this class (not the instance).

Get all extension instances for this specific object instance. See Object::get_extensions() to get all applied extension classes for this class (not the instance).

Returns

array
Map of DataObjectDecorator instances, keyed by classname.
public mixed
# cacheToFile( string $method, integer $lifetime = 3600, string $ID = false, array $arguments = array() )

Cache the results of an instance method in this object to a file, or if it is already cache return the cached results

Cache the results of an instance method in this object to a file, or if it is already cache return the cached results

Parameters

$method
string $method the method name to cache
$lifetime
int $lifetime the cache lifetime in seconds
$ID
string $ID custom cache ID to use
$arguments
array $arguments an optional array of arguments

Returns

mixed
the cached data
public
# clearCache( mixed $method, mixed $ID = false, mixed $arguments = array() )

Clears the cache for the given cacheToFile call

Clears the cache for the given cacheToFile call

public
# cacheToFileWithArgs( mixed $callback, mixed $arguments = array(), mixed $lifetime = 3600, mixed $ID = false )

Deprecated

protected mixed
# loadCache( string $cache, integer $lifetime = 3600 )

Loads a cache from the filesystem if a valid on is present and within the specified lifetime

Loads a cache from the filesystem if a valid on is present and within the specified lifetime

Parameters

$cache
string $cache the cache name
$lifetime
int $lifetime the lifetime (in seconds) of the cache before it is invalid

Returns

mixed
mixed
protected
# saveCache( string $cache, mixed $data )

Save a piece of cached data to the file system

Save a piece of cached data to the file system

Parameters

$cache
string $cache the cache name
$data
mixed $data data to save (must be serializable)
protected string
# sanitiseCachename( string $name )

Strip a file name of special characters so it is suitable for use as a cache file name

Strip a file name of special characters so it is suitable for use as a cache file name

Parameters

$name
string $name

Returns

string
the name with all special cahracters replaced with underscores
public
# extInstance( mixed $extension )

Deprecated

2.4 Use getExtensionInstance

Magic methods summary

Properties summary

public static array $extensions
#

An array of extension names and parameters to be applied to this object upon construction.

An array of extension names and parameters to be applied to this object upon construction.

Example:

public static $extensions = array (
  'Hierachy',
  "Version('Stage', 'Live')"
);

Use Object::add_extension() to add extensions without access to the class code, e.g. to extend core classes.

Extensions are instanciated together with the object and stored in Object::$extension_instances.

public string $class
#

the class name

the class name

protected array $extension_instances
#

all current extension instances.

all current extension instances.

[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. -
Webylon 3.2 API Docs API documentation generated by ApiGen 2.8.0