Class \Scrivo\Asset

Defined in: Asset.php.


Constructor summary

Attr. Name / Description
public

Asset($context)

Create an empty asset object.

Constant summary

Name Description
TYPE_FILE Value indicating that the asset is a file.
TYPE_FOLDER Value indicating that the asset is a folder.

Member summary

Attr. Type Name Description
protected \..\AssetSet $children The child assets of this asset.
protected \..\Context $context A Scrivo context.
protected DateTime $dateCreated The date/time that this asset was created.
protected DateTime $dateModified The last date/time that this asset was modified.
protected int $id The asset id (DB key).
protected int $parentId The id of the parent asset.
protected \..\AssetSet $path The parent assets of this asset.
protected \..\RoleSet $roles The attached roles.
protected \..\String $title The asset title.
protected int $type The asset type: one out of the Asset::TYPE_* constant values.

Method summary

Attr. Type Name / Description
public mixed

__get($name)

Implementation of the readable properties using the PHP magic method __get().

public

__set($name, $value)

Implementation of the writable properties using the PHP magic method __set().

public static

delete($context, $id)

Delete an existing asset from the database.

public static

fetch($context, $id)

Retrieve a asset from the database or cache.

private \..\AssetSet

getChildren()

Get the child assets of this asset.

private \..\AssetSet

getPath()

Get the child assets of this asset.

public

move($dir)

Move a asset one position up or down amongst its siblings.

private static \..\AssetSet

selectChildren($asset)

Select child assets from the database.

protected static \..\AssetSet

selectPath($asset)

Select the asset path.

private static

selectRoles($context, $assets)

Select the roles for this asset.

private

setContext($context)

Set the asset context.

protected

setFields($context, $rd)

Convenience method to set the fields of a asset definition object from an array (result set row).

private

setParentId($parentId)

Set the id of the parent asset.

private

setTitle($title)

Set The asset title (<title>).

private

setType($type)

Set the asset type: one out of the Asset::TYPE_* constant values.

 


Constructor

public Asset(\Scrivo\Context $context=null)

Create an empty asset object.

Parameters:

Type Name Def. Description
\Scrivo\Context $context null

A Scrivo context.


Constants

TYPE_FILE

Value indicating that the asset is a file.

Value: 1

TYPE_FOLDER

Value indicating that the asset is a folder.

Value: 0


Members


				
protected \Scrivo\AssetSet $children

The child assets of this asset.

Inital value: null


				
protected \Scrivo\Context $context

A Scrivo context.

Inital value: null


				
protected \DateTime $dateCreated

The date/time that this asset was created.

Inital value: null


				
protected \DateTime $dateModified

The last date/time that this asset was modified.

Inital value: null


				
protected int $id

The asset id (DB key).

Inital value: 0


				
protected int $parentId

The id of the parent asset.

Inital value: 0


				
protected \Scrivo\AssetSet $path

The parent assets of this asset.

Inital value: null


				
protected \Scrivo\RoleSet $roles

The attached roles.

Inital value: null


				
protected \Scrivo\String $title

The asset title.

Inital value: null


				
protected int $type

The asset type: one out of the Asset::TYPE_* constant values.

Inital value: 0


Methods

public mixed __get(string $name)

Implementation of the readable properties using the PHP magic method __get().

Parameters:

Type Name Def. Description
string $name

The name of the property to get.

Returns:

mixed Implementation of the readable properties using the PHP magic method __get().

public __set(string $name, mixed $value)

Implementation of the writable properties using the PHP magic method __set().

Parameters:

Type Name Def. Description
string $name

The name of the property to set.

mixed $value

The value of the property to set.

public static delete(\Scrivo\Context $context, int $id)

Delete an existing asset from the database.

First it is is checked if it's possible to delete this asset then the asset data including its dependecies is deleted from the database.

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A Scrivo context.

int $id

The id of the asset to delete.

Throws:

Exception Type Description
\Scrivo\ApplicationException If it is not possible to delete this asset.
public static fetch(\Scrivo\Context $context, int $id=null)

Retrieve a asset from the database or cache.

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A Scrivo context.

int $id null

An object id of a asset.

Throws:

Exception Type Description
\Scrivo\ApplicationException if the asset was not readable for the user defined in the context.
private \Scrivo\AssetSet getChildren()

Get the child assets of this asset.

Returns:

\Scrivo\AssetSet Get the child assets of this asset.

private \Scrivo\AssetSet getPath()

Get the child assets of this asset.

Returns:

\Scrivo\AssetSet Get the child assets of this asset.

public move(int $dir=\Scrivo\SequenceNo::MOVE_DOWN)

Move a asset one position up or down amongst its siblings.

Parameters:

Type Name Def. Description
int $dir \Scrivo\SequenceNo::MOVE_DOWN

Direction of the move, see \Scrivo\SequenceNo:::MOVE_*

private static \Scrivo\AssetSet selectChildren(\Scrivo\Asset $asset)

Select child assets from the database.

Parameters:

Type Name Def. Description
\Scrivo\Asset $asset

A Scrivo asset.

Returns:

\Scrivo\AssetSet Select child assets from the database.

protected static \Scrivo\AssetSet selectPath(\Scrivo\Asset $asset)

Select the asset path.

Parameters:

Type Name Def. Description
\Scrivo\Asset $asset

A Scrivo asset.

Returns:

\Scrivo\AssetSet Select the asset path.

private static selectRoles(\Scrivo\Context $context, array $assets)

Select the roles for this asset.

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A valid Scrivo context.

array $assets

the set of assets for which to retrieve the properties.

private setContext(\Scrivo\Context $context)

Set the asset context.

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A Scrivo context.

protected setFields(\Scrivo\Context $context, array $rd)

Convenience method to set the fields of a asset definition object from an array (result set row).

Parameters:

Type Name Def. Description
\Scrivo\Context $context

A Scrivo context.

array $rd

An array containing the field data using the database field names as keys.

private setParentId(int $parentId)

Set the id of the parent asset.

Parameters:

Type Name Def. Description
int $parentId

The id of the parent asset.

private setTitle(\Scrivo\String $title)

Set The asset title (<title>).

Parameters:

Type Name Def. Description
\Scrivo\String $title

The asset title (<title>).

private setType(int $type)

Set the asset type: one out of the Asset::TYPE_* constant values.

Parameters:

Type Name Def. Description
int $type

The asset type: one out of the Asset::TYPE_* constant values.


Documentation generated by phpDocumentor 2.0.0a12 and ScrivoDocumentor on August 29, 2013