Class lispa\amos\attachments\behaviors\FileBehavior
Inheritance | lispa\amos\attachments\behaviors\FileBehavior » yii\base\Behavior » yii\base\Object |
---|---|
Implements | yii\base\Configurable |
Uses Traits | lispa\amos\attachments\FileModuleTrait |
Class FileBehavior
Public Properties
Public Methods
Protected Methods
Property Details
Method Details
Parse file behaviors and find for the choosed attribute for hasOne or hasMultiple files relation
public array|mixed __get ( $name ) | ||
$name | string | |
throws | yii\base\UnknownPropertyException |
---|
Setter is an override tool for validation
public void __set ( $name, $value ) | ||
$name | ||
$value |
Add files attributes as avaiable property for Getter
public boolean canGetProperty ( $name, $checkVars = true ) | ||
$name | ||
$checkVars |
Add files attributes as avaiable property for Setter
public boolean canSetProperty ( $name, $checkVars = true ) | ||
$name | ||
$checkVars |
protected void cropImage ( yii\web\UploadedFile $file, $data ) | ||
$file | ||
$data |
public void deleteUploads ( $event ) | ||
$event |
When update save files before the validation
public boolean|void evalAttributes ( $event ) | ||
$event |
Declares event handlers for the $owner's events.
Child classes may override this method to declare what PHP callbacks should be attached to the events of the $owner component.
The callbacks will be attached to the $owner's events when the behavior is attached to the owner; and they will be detached from the events when the behavior is detached from the component.
The callbacks can be any of the following:
- method in this behavior:
'handleClick'
, equivalent to[$this, 'handleClick']
- object method:
[$object, 'handleClick']
- static method:
['Page', 'handleClick']
- anonymous function:
function ($event) { ... }
The following is an example:
[
Model::EVENT_BEFORE_VALIDATE => 'myBeforeValidate',
Model::EVENT_AFTER_VALIDATE => 'myAfterValidate',
]
public array events ( ) | ||
return | array | Events (array keys) and the corresponding event handler methods (array values). |
---|
Return array of attributes which may contain files
public array getFileAttributes ( ) |
public integer getFileCount ( ) | ||
throws | Exception |
---|
public boolean|mixed|yii\validators\FileValidator|yii\validators\Validator getFileValidator ( $attributeName ) | ||
$attributeName |
Check if owner model has file validator
public yii\validators\Validator[] getFileValidators ( $validators ) | ||
$validators |
public lispa\amos\attachments\models\File[] getFiles ( $andWhere = '' ) | ||
$andWhere | string |
DEPRECATED
public void getFilesByAttributeName ( $attribute = 'file', $sort = 'id' ) | ||
$attribute | ||
$sort |
public yii\db\ActiveQuery getFilesQuery ( $andWhere = '' ) | ||
$andWhere | string |
public array getInitialPreviewByAttributeName ( $attribute = 'file', $size = null ) | ||
$attribute | string | |
$size |
public array getInitialPreviewConfigByAttributeName ( $attribute = 'file' ) | ||
$attribute | string |
DEPRECATED
public void getSingleFileByAttributeName ( $attribute = 'file', $sort = 'id' ) | ||
$attribute | ||
$sort |
public mixed getStatsToolbar ( ) |
public yii\db\ActiveQuery hasMultipleFiles ( $attribute = 'file', $sort = 'id' ) | ||
$attribute | string | |
$sort | string |
public yii\db\ActiveQuery hasOneFile ( $attribute = 'file', $sort = 'id' ) | ||
$attribute | string | |
$sort | string |
protected void saveAttributeUploads ( $attribute ) | ||
$attribute |
Iterate files and save by attribute
public void saveUploads ( $event ) | ||
$event |
Unset attributes from override
public boolean unevalAttributes ( ) |