Skip to content

Internals Vfs Storage StorageEntry

Stefan Crkvenjakov edited this page Oct 7, 2026 · 1 revision

vfs\storage\StorageEntry

Framework Internals · Subsystem overview · Developer guide

Source: awt_src/classes/vfs/storage/StorageEntry.php · Snapshot 8411f4287706.

VFS includes package resource lookup, database-backed file metadata, filesystem collaborators, transient pools and persistent PHP-array caches.

Imports and dependencies

use model\exceptions\ModelCreationException;
use model\Model;
use vfs\storage\enums\EOwnerType;

StorageEntry

Declaration and architectural role

class StorageEntry extends Model

Source description (behavioral corrections are recorded in Known discrepancies):

Class StorageEntry

A pure data-model/entity (SRP). All file system concerns have been removed and now live in LocalFileSystemService. This class is only responsible for holding and validating storage entry state.

Constants, enum cases, traits and properties

Declarations below preserve visibility, type, default and modifiers exactly. A typed property without an initializer remains uninitialized until its constructor or another method assigns it. Mutable fields belong to this instance unless marked static; readonly fields can be initialized once. Constructor-promoted properties are also listed below.

Member Declaration Purpose or source contract
$id public ?int $id; Used by __construct(), setUrl(), getId().
$name public ?string $name = null; Used by setName(), setUrl(), getName().
$path public ?string $path = null; Used by setPath(), getPath().
$url public ?string $url = null; Used by setUrl(), getUrl().
$size public ?int $size = null; Used by setSize(), getSize().
$middleware public ?string $middleware = null; Used by setMiddleware(), getMiddleware().
$lastModified public ?int $lastModified = 0; Used by setLastModified(), getLastModified().
$ownerId public ?int $ownerId = null; Used by setOwnerId(), getOwnerId().
$ownerType public string|EOwnerType $ownerType = EOwnerType::USER; Used by setOwnerType(), getOwnerType().
Constructor-promoted public function __construct(?int $id = null) Initialized from the constructor argument; default expression is evaluated when the argument is omitted.

Method index

Method Signature
__construct public function __construct(?int $id = null)
setPath public function setPath(string $path): self
setSize public function setSize(int $size): self
setLastModified public function setLastModified(int $lastModified): self
setName public function setName(string $name): self
setUrl public function setUrl(?string $url = null): self
setMiddleware public function setMiddleware(?string $middleware = null): self
setOwnerId public function setOwnerId(?int $ownerId = null): self
setOwnerType public function setOwnerType(?EOwnerType $ownerType = null): self
getOwnerId public function getOwnerId(): ?int
getOwnerType public function getOwnerType(): ?EOwnerType
getMiddleware public function getMiddleware(): ?string
getPath public function getPath(): string
getUrl public function getUrl(): string
getName public function getName(): string
getSize public function getSize(): int
getLastModified public function getLastModified(): int
getId public function getId(): ?int

__construct

Source line 31

public function __construct(?int $id = null)

Parameters

Parameter Type, modifiers and default Purpose
$id ?int $id = null Record or runtime identifier selected by this operation.

@throws ModelCreationException

State writes: $this->id, $this->model_source.

Implementation, validation guards and interaction order
/**
     * @throws ModelCreationException
     */
    public function __construct(?int $id = null)
    {
        parent::__construct();

        $this->id = $id;
        $this->model_source = 'awt_storage';
        if ($this->id !== null) {
            $this->selectByID($this->id, 'awt_storage');
        }
    }

setPath

Source line 46

public function setPath(string $path): self

Parameters

Parameter Type, modifiers and default Purpose
$path string $path Filesystem or route path as defined by the owning component; no universal path normalization is implied.

State writes: $this->path.

Return expressions (including local callbacks): $this.

Implementation, validation guards and interaction order
// ----------------------------------------------------------------
    // Fluent setters
    // ----------------------------------------------------------------

    public function setPath(string $path): self
    {
        $this->path = $path;
        return $this;
    }

setSize

Source line 55

public function setSize(int $size): self

Parameters

Parameter Type, modifiers and default Purpose
$size int $size Pre-computed file size in bytes.

@param int $size Pre-computed file size in bytes.

State writes: $this->size.

Return expressions (including local callbacks): $this.

Implementation, validation guards and interaction order
/**
     * @param int $size Pre-computed file size in bytes.
     */
    public function setSize(int $size): self
    {
        $this->size = $size;
        return $this;
    }

setLastModified

Source line 64

public function setLastModified(int $lastModified): self

Parameters

Parameter Type, modifiers and default Purpose
$lastModified int $lastModified Unix timestamp of the last modification.

@param int $lastModified Unix timestamp of the last modification.

State writes: $this->lastModified.

Return expressions (including local callbacks): $this.

Implementation, validation guards and interaction order
/**
     * @param int $lastModified Unix timestamp of the last modification.
     */
    public function setLastModified(int $lastModified): self
    {
        $this->lastModified = $lastModified;
        return $this;
    }

setName

Source line 70

public function setName(string $name): self

Parameters

Parameter Type, modifiers and default Purpose
$name string $name Named key/label selected by this API; its exact scope is shown by the implementation trace.

State writes: $this->name.

Return expressions (including local callbacks): $this.

Implementation, validation guards and interaction order
public function setName(string $name): self
    {
        $this->name = $name;
        return $this;
    }

setUrl

Source line 79

public function setUrl(?string $url = null): self

Parameters

Parameter Type, modifiers and default Purpose
$url ?string $url = null Operation input; the exact use, validation and propagation are shown in the implementation trace.

Provide an explicit URL, or pass null to derive it from id + name.

State writes: $this->url.

Return expressions (including local callbacks): $this.

Implementation, validation guards and interaction order
/**
     * Provide an explicit URL, or pass null to derive it from id + name.
     */
    public function setUrl(?string $url = null): self
    {
        $this->url = $url ?? '/storage/' . $this->id . '/' . rawurlencode($this->name ?? '');
        return $this;
    }

setMiddleware

Source line 85

public function setMiddleware(?string $middleware = null): self

Parameters

Parameter Type, modifiers and default Purpose
$middleware ?string $middleware = null Middleware object or class name according to the component; route and storage return handling differ.

State writes: $this->middleware.

Return expressions (including local callbacks): $this.

Implementation, validation guards and interaction order
public function setMiddleware(?string $middleware = null): self
    {
        $this->middleware = $middleware;
        return $this;
    }

setOwnerId

Source line 91

public function setOwnerId(?int $ownerId = null): self

Parameters

Parameter Type, modifiers and default Purpose
$ownerId ?int $ownerId = null Owning record ID or null.

State writes: $this->ownerId.

Return expressions (including local callbacks): $this.

Implementation, validation guards and interaction order
public function setOwnerId(?int $ownerId = null): self
    {
        $this->ownerId = $ownerId;
        return $this;
    }

setOwnerType

Source line 97

public function setOwnerType(?EOwnerType $ownerType = null): self

Parameters

Parameter Type, modifiers and default Purpose
$ownerType ?EOwnerType $ownerType = null Storage owner category; a matching registered strategy is required for registration.

State writes: $this->ownerType.

Return expressions (including local callbacks): $this.

Implementation, validation guards and interaction order
public function setOwnerType(?EOwnerType $ownerType = null): self
    {
        $this->ownerType = $ownerType ?? EOwnerType::USER;
        return $this;
    }

getOwnerId

Source line 107

public function getOwnerId(): ?int

Return expressions (including local callbacks): $this->ownerId.

Implementation, validation guards and interaction order
// ----------------------------------------------------------------
    // Getters
    // ----------------------------------------------------------------

    public function getOwnerId(): ?int
    {
        return $this->ownerId;
    }

getOwnerType

Source line 112

public function getOwnerType(): ?EOwnerType

Return expressions (including local callbacks): $this->ownerType instanceof EOwnerType ? $this->ownerType : EOwnerType::from($this->ownerType).

Implementation, validation guards and interaction order
public function getOwnerType(): ?EOwnerType
    {
        return $this->ownerType instanceof EOwnerType ? $this->ownerType : EOwnerType::from($this->ownerType);
    }

getMiddleware

Source line 117

public function getMiddleware(): ?string

Return expressions (including local callbacks): $this->middleware.

Implementation, validation guards and interaction order
public function getMiddleware(): ?string
    {
        return $this->middleware;
    }

getPath

Source line 122

public function getPath(): string

Return expressions (including local callbacks): $this->path.

Implementation, validation guards and interaction order
public function getPath(): string
    {
        return $this->path;
    }

getUrl

Source line 127

public function getUrl(): string

Return expressions (including local callbacks): $this->url.

Implementation, validation guards and interaction order
public function getUrl(): string
    {
        return $this->url;
    }

getName

Source line 132

public function getName(): string

Return expressions (including local callbacks): $this->name.

Implementation, validation guards and interaction order
public function getName(): string
    {
        return $this->name;
    }

getSize

Source line 137

public function getSize(): int

Return expressions (including local callbacks): $this->size.

Implementation, validation guards and interaction order
public function getSize(): int
    {
        return $this->size;
    }

getLastModified

Source line 142

public function getLastModified(): int

Return expressions (including local callbacks): $this->lastModified.

Implementation, validation guards and interaction order
public function getLastModified(): int
    {
        return $this->lastModified;
    }

getId

Source line 147

public function getId(): ?int

Return expressions (including local callbacks): $this->id.

Implementation, validation guards and interaction order
public function getId(): ?int
    {
        return $this->id;
    }

Related types

Clone this wiki locally