Class File
This class handles the representation of a File within Sapphire Note: The files are stored in the assets/ directory, but sapphire looks at the db object to gather information about a file such as URL It then uses this for all processing functions (like image manipulation).
- Object
-
ViewableData
implements
IteratorAggregate
-
DataObject
implements
DataObjectInterface,
i18nEntityProvider
-
File
Indirect known subclasses
Methods summary
public static
mixed
|
|
public
|
|
public
|
|
public
|
|
public
|
|
protected
|
#
onBeforeDelete( )
Event handler called before deleting from the database. You can overload this to clean up or otherwise process data before delete this record. Don't forget to call parent::onBeforeDelete(), though! |
protected
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
#
deleteDatabaseOnly( )
Delete the database record (recursively for folders) without touching the filesystem |
protected
|
#
onBeforeWrite( )
Event handler called before deleting from the database. You can overload this to clean up or otherwise process data before delete this record. Don't forget to call parent::onBeforeWrite(), though! |
public
|
#
collateDescendants( condition $condition, collator & $collator )
Collate selected descendants of this page. $condition will be evaluated on each descendant, and if it is succeeds, that item will be added to the $collator array. |
public
|
|
protected
|
#
resetFilename( mixed $renamePhysicalFile = true )
Change a filename, moving the file if appropriate. |
protected
|
|
public
|
#
setField( string $field, mixed $value )
Set the value of the field Called by |
protected
|
#
updateLinks( mixed $old, mixed $new )
Rewrite links to the $old file to now point to the $new file |
public
|
|
public
string
|
|
public
string
|
|
public
|
|
public
|
|
public
String
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public static
string
|
#
get_file_extension( string $filename )
Gets the extension of a filepath or filename, by stripping away everything before the last "dot". |
public
string
|
|
public
|
|
public static
|
|
public
integer
|
|
public
mixed
|
#
instance_get( string $filter = "", string $sort = "", string $join = "", string $limit = "", string $containerClass = "DataObjectSet", mixed $having = "" )
We've overridden the DataObject::get function for File so that the very large content field is excluded! |
public
|
#
flushCache( )
Flush the cached results for all relations (has_one, has_many, many_many) Also clears any cached aggregate data |
public
array|string
|
|
public
A
|
|
public
|
#
uploadMetadataFields( )
Allow custom fields for uploads in |
public
|
Methods inherited from DataObject
Aggregate(),
RelationshipAggregate(),
__construct(),
baseTable(),
belongs_to(),
buildDataObjectSet(),
buildSQL(),
can(),
castedUpdate(),
composite_fields(),
context_obj(),
customDatabaseFields(),
custom_database_fields(),
data(),
databaseFields(),
databaseIndexes(),
database_extensions(),
database_fields(),
db(),
dbObject(),
debug(),
defaultSearchFilters(),
defineMethods(),
delete(),
delete_by_id(),
destroy(),
disableCMSFieldsExtensions(),
disable_subclass_access(),
duplicate(),
enableCMSFieldsExtensions(),
enable_subclass_access(),
exists(),
extendedSQL(),
fieldLabel(),
flush_and_destroy_cache(),
forceChange(),
get(),
getAllFields(),
getCMSActions(),
getCMSFields(),
getChangedFields(),
getClassAncestry(),
getComponent(),
getComponents(),
getComponentsQuery(),
getDefaultSearchContext(),
getField(),
getFrontEndFields(),
getManyManyComponents(),
getManyManyComponentsQuery(),
getManyManyFilter(),
getManyManyJoin(),
getRemoteJoinField(),
getReverseAssociation(),
getTitle(),
get_by_id(),
get_one(),
get_validation_enabled(),
hasDatabaseField(),
hasField(),
hasOwnTableDatabaseField(),
hasValue(),
has_many(),
has_one(),
has_own_table(),
i18n_plural_name(),
i18n_singular_name(),
inheritedDatabaseFields(),
instance_get_one(),
isChanged(),
isEmpty(),
isInDB(),
is_composite_field(),
many_many(),
many_many_extraFields(),
merge(),
newClassInstance(),
onAfterWrite(),
plural_name(),
populateDefaults(),
provideI18nEntities(),
relObject(),
requireDefaultRecords(),
requireTable(),
reset(),
scaffoldFormFields(),
scaffoldSearchFields(),
searchableFields(),
setCastedField(),
setClassName(),
setComponent(),
set_context_obj(),
set_validation_enabled(),
singular_name(),
summaryFields(),
toMap(),
update(),
write(),
writeComponents(),
writeWithoutVersion()
Methods inherited from ViewableData
ATT_val(),
BaseHref(),
CSSClasses(),
ColumnBreak(),
ColumnCalc(),
ColumnNumber(),
ColumnPad(),
ColumnPos(),
CurrentMember(),
CurrentPage(),
Debug(),
Even(),
EvenOdd(),
First(),
FirstLast(),
HasPerm(),
IsAjax(),
JS_val(),
Last(),
Me(),
Middle(),
MiddleString(),
Modulus(),
MultipleOf(),
Odd(),
Pos(),
RAW_val(),
SQL_val(),
ThemeDir(),
ThemeName(),
Top(),
TotalItems(),
XML_val(),
__get(),
__isset(),
__set(),
buildCastingCache(),
cachedCall(),
castingClass(),
castingHelper(),
castingHelperPair(),
castingObjectCreator(),
castingObjectCreatorPair(),
customise(),
escapeTypeForField(),
getIterator(),
getSecurityID(),
getXMLValues(),
i18nLocale(),
iteratorProperties(),
obj(),
renderWith(),
setCustomisedObj()
Methods inherited from Object
__call(),
__toString(),
__wakeup(),
addMethodsFrom(),
addStaticVars(),
addWrapperMethod(),
add_extension(),
add_static_var(),
allMethodNames(),
cacheToFile(),
cacheToFileWithArgs(),
clearCache(),
combined_static(),
create(),
createMethod(),
create_from_string(),
extInstance(),
extend(),
getCustomClass(),
getExtensionInstance(),
getExtensionInstances(),
get_extensions(),
get_static(),
hasExtension(),
hasMethod(),
has_extension(),
invokeWithExtensions(),
is_a(),
loadCache(),
parentClass(),
parse_class_spec(),
remove_extension(),
sanitiseCachename(),
saveCache(),
set_stat(),
set_static(),
set_uninherited(),
stat(),
strong_create(),
uninherited(),
uninherited_static(),
useCustomClass()
Magic methods summary
Properties summary
public static
string
|
$default_sort |
#
The default sort expression. This will be inserted in the ORDER BY clause of a SQL query if no other sort expression is provided. |
public static
string
|
$singular_name |
#
Human-readable singular name. |
public static
string
|
$plural_name |
#
Human-readable pluaral name |
public static
array
|
$db |
#
Database field definitions. This is a map from field names to field type. The field type should be a class that extends . |
public static
array
|
$has_one |
#
One-to-zero relationship defintion. This is a map of component name to data
type. In order to turn this into a true one-to-one relationship you can add a
|
public static
array
|
$has_many |
#
This defines a one-to-many relationship. It is a map of component name to the remote data class. |
public static
array
|
$many_many |
#
many-many relationship definitions. This is a map from component name to data type. |
public static
array
|
$belongs_many_many |
#
The inverse side of a many-many relationship. This is a map from component name to data type. |
public static
array
|
$defaults |
#
Inserts standard column-values when a DataObject is instanciated. Does not
insert default records |
public static
array
|
$extensions |
#
An array of extension names and parameters to be applied to this object upon construction. |
public static
array
|
$indexes |
#
If a field is in this array, then create a database index on that field. This is a map from fieldname to index type. See SS_Database->requireIndex() and custom subclasses for details on the array notation. |
public static
array
|
$allowed_extensions | |
public static
boolean
|
$apply_restrictions_to_admin |
#
If this is true, then restrictions set in $allowed_max_file_size and $allowed_extensions will be applied to users with admin privileges as well. |
protected static
array
|
$cache_file_fields |
#
Cached result of a "SHOW FIELDS" call in instance_get() for performance reasons. |
Properties inherited from DataObject
$allowed_actions,
$ancestry,
$api_access,
$belongs_to,
$brokenOnDelete,
$brokenOnWrite,
$cache_get_one,
$cache_has_own_table,
$cache_has_own_table_field,
$casting,
$componentCache,
$components,
$create_table_options,
$default_records,
$destroyed,
$field_labels,
$many_many_extraFields,
$original,
$record,
$searchable_fields,
$summary_fields
Properties inherited from ViewableData
$customisedObject,
$default_cast,
$failover,
$iteratorPos,
$iteratorTotalItems