service/models/StoredContentChunk.php
/**
     * Creates content chunk file and returns its name
     *
     * @return string
     */
Creates content chunk file and returns its name
@return string
Creates content chunk file and returns its name @return string
public function createFile()
    {
        if (!empty($this->getDirtyAttributes(['stored_content_id']))) {
            $storedContent = $this->storedContent;
            if ($storedContent != null) {
                $storage = Yii::$app->storage;
                if (!($file = $storage->createFile($storedContent->name.'.chunk'))) {
                    throw new Exception('Failed to create stored content chunk file.');
                }
                return $file;
            } else {
                throw new Exception('Stored content for this chunk is not found.');
            }
        } else {
            return $this->file;
        }
    }
public function createFile ( ) { if ( ! empty ( $ this -> getDirtyAttributes ( [ 'stored_content_id' ] ) ) ) { $ storedContent = $ this -> storedContent ; if ( $ storedContent != null ) { $ storage = Yii :: $ app -> storage ; if ( ! ( $ file = $ storage -> createFile ( $ storedContent -> name . '.chunk' ) ) ) { throw new Exception ( 'Failed to create stored content chunk file.' ) ; } return $ file ; } else { throw new Exception ( 'Stored content for this chunk is not found.' ) ; } } else { return $ this -> file ; } }
Creates content chunk file and returns its name
 @return string
Creates content chunk file and returns its name @return string
//Since chunk's file name depends on stored content name we need to update it only if //chunk is linked to different stored content