Class humhub\modules\file\models\File

Inheritancehumhub\modules\file\models\File » humhub\modules\file\models\FileCompat » humhub\components\ActiveRecord » yii\db\ActiveRecord
ImplementsSerializable
Subclasseshumhub\modules\file\models\FileContent, humhub\modules\file\models\FileUpload
Available since version0.5

This is the model class for table "file".

The followings are the available columns in table 'file':

Public Methods

Hide inherited methods

MethodDescriptionDefined By
attachPrecreated() Attaches a given list of files to an record (HActiveRecord). humhub\modules\file\models\FileCompat
beforeDelete() humhub\modules\file\models\File
beforeSave() humhub\components\ActiveRecord
behaviors() humhub\modules\file\models\File
canDelete() Checks if given file can deleted. humhub\modules\file\models\File
canRead() Checks if given file can read. humhub\modules\file\models\File
findByRecord() Returns all attached Files of the given $record. humhub\modules\file\models\File
getCreatedBy() Relation to User defined in created_by attribute humhub\components\ActiveRecord
getErrorMessage() Returns the errors as string for all attribute or a single attribute. humhub\components\ActiveRecord
getExtension() Returns the extension of the file_name humhub\modules\file\models\FileCompat
getFileManager() Returns the file manager for this record humhub\components\ActiveRecord
getFilename() Returns the filename humhub\modules\file\models\FileCompat
getFilesOfObject() Returns all files belongs to a given HActiveRecord Object. humhub\modules\file\models\FileCompat
getInfoArray() Returns an array with informations about the file humhub\modules\file\models\FileCompat
getMimeBaseType() humhub\modules\file\models\FileCompat
getMimeSubType() humhub\modules\file\models\FileCompat
getPreviewImageUrl() Return the preview image url of the file humhub\modules\file\models\FileCompat
getStore() Returns the StorageManager humhub\modules\file\models\File
getStoredFilePath() Returns the path of stored file humhub\modules\file\models\FileCompat
getUniqueId() Returns a unique id for this record/model humhub\components\ActiveRecord
getUpdatedBy() Relation to User defined in updated_by attribute humhub\components\ActiveRecord
getUrl() Returns the url to this file humhub\modules\file\models\File
isAssigned() Checks if this file record is already attached to record. humhub\modules\file\models\File
isAssignedTo() Checks if this file is attached to the given record humhub\modules\file\models\File
rules() humhub\modules\file\models\File
serialize() Serializes attributes and oldAttributes of this record. humhub\components\ActiveRecord
tableName() humhub\modules\file\models\File
unserialize() Unserializes the given string, calls the init() function and sets the attributes and oldAttributes. humhub\components\ActiveRecord

Method Details

beforeDelete() public method

public void beforeDelete ( )
behaviors() public method

public void behaviors ( )
canDelete() public method

Checks if given file can deleted.

If the file is not an instance of ContentActiveRecord or ContentAddonActiveRecord the file is readable for all unless there is method canEdit or canDelete implemented.

public void canDelete ( $userId null )
$userId
canRead() public method

Checks if given file can read.

If the file is not an instance of HActiveRecordContent or HActiveRecordContentAddon the file is readable for all.

public void canRead ( $userId "" )
$userId
findByRecord() public static method

Returns all attached Files of the given $record.

public static humhub\modules\file\models\File[] findByRecord ( \yii\db\ActiveRecord $record )
$record \yii\db\ActiveRecord
getStore() public method

Returns the StorageManager

public humhub\modules\file\components\StorageManager getStore ( )
throws \yii\base\InvalidConfigException
getUrl() public method

Returns the url to this file

Available params (see also: DownloadAction)

  • variant: the requested file variant
  • download: force download option (default: false)
public string getUrl ( $params = [], $absolute true )
$params array

The params

$absolute boolean
return string

The url to the file download

isAssigned() public method

Checks if this file record is already attached to record.

public boolean isAssigned ( )
return boolean

Is whether in use or not

isAssignedTo() public method

Checks if this file is attached to the given record

public boolean isAssignedTo ( \yii\db\ActiveRecord $record )
$record \yii\db\ActiveRecord
rules() public method

public void rules ( )
tableName() public static method

public static void tableName ( )