Documentation

Sesha_Driver
in package

This is the base Driver class for the Sesha application.

Copyright 2004-2007 Andrew Coleman mercury@appisolutions.net Copyright 2011-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.

Tags
author

Andrew Coleman mercury@appisolutions.net

author

Ralf Lang lang@b1-systems.de

Table of Contents

$_params  : mixed
$_stock  : array<string|int, mixed>
Variable holding the items in the inventory.
__construct()  : mixed
add()  : Sesha_Entity_Stock
This will add a new item to the inventory.
addCategory()  : int
Adds a new category for classifying inventory.
addProperty()  : Sesha_Entity_Property
Adds a new property to the storage backend.
categoryExists()  : bool
Determines if a category exists in the storage backend.
clearPropertiesForCategory()  : int
Removes all properties for a specified category.
clearPropertiesForStock()  : int
Removes categories from a particular stock item.
delete()  : bool
Removes a stock entry from the backend. Also removes all related category and property information.
deleteCategory()  : int
Deletes a category.
deleteProperty()  : int
Deletes a property from the storage backend.
fetch()  : Sesha_Entity_Stock
This function retrieves a single stock item from the backend.
findStock()  : array<string|int, mixed>
Inventory search
getCategories()  : array<string|int, mixed>
This function returns all the categories matching an id or category list.
getCategory()  : Sesha_Entity_Category
This will return the category found matching a specific id.
getProperties()  : array<string|int, mixed>
This will find all the available properties matching a specified IDs.
getPropertiesForCategories()  : mixed
This will return a set of properties for a set of specified categories.
getPropertiesForStock()  : array<string|int, mixed>
Returns a set of properties for a particular stock ID number.
getProperty()  : mixed
Finds the first matching property for a specified property ID.
getValuesForStock()  : array<string|int, mixed>
Returns a set of Value Objects for a particular stock ID number.
modify()  : bool
This function will modify a pre-existing stock entry with new values.
setPropertiesForCategory()  : mixed
Updates a category with a set of properties.
updateCategoriesForStock()  : mixed
Updates the set of categories for a specified stock item.
updateCategory()  : int
Updates the attributes stored by a category.
updatePropertiesForStock()  : mixed
Updates the set of properties for a particular stock item.
updateProperty()  : Sesha_Inventory_Property
Updates a property with new attributes.

Properties

$_params

protected mixed $_params

$_stock

Variable holding the items in the inventory.

protected array<string|int, mixed> $_stock

Methods

__construct()

public __construct([mixed $params = array() ]) : mixed
Parameters
$params : mixed = array()
Return values
mixed

add()

This will add a new item to the inventory.

public abstract add(array<string|int, mixed> $stock) : Sesha_Entity_Stock
Parameters
$stock : array<string|int, mixed>

A hash of values for the stock item.

Tags
throws
Sesha_Exception
Return values
Sesha_Entity_Stock

The newly added item or false.

addCategory()

Adds a new category for classifying inventory.

public abstract addCategory(array<string|int, mixed> $info) : int
Parameters
$info : array<string|int, mixed>

The new category's attributes.

Tags
throws
Sesha_Exception
Return values
int

The ID of the new of the category on success

addProperty()

Adds a new property to the storage backend.

public abstract addProperty(array<string|int, mixed> $info) : Sesha_Entity_Property
Parameters
$info : array<string|int, mixed>

Array with new property values.

Return values
Sesha_Entity_Property

categoryExists()

Determines if a category exists in the storage backend.

public abstract categoryExists(string $category) : bool
Parameters
$category : string

The string representation of the category to find.

Return values
bool

True on success; false otherwise.

clearPropertiesForCategory()

Removes all properties for a specified category.

public abstract clearPropertiesForCategory(int $category_id) : int
Parameters
$category_id : int

The numeric ID of the category to update.

Tags
throws
Sesha_Exception
Return values
int

The number of deleted properties

clearPropertiesForStock()

Removes categories from a particular stock item.

public abstract clearPropertiesForStock(int $stock_id[, array<string|int, mixed> $categories = array() ]) : int
Parameters
$stock_id : int

The numeric ID of the stock item to update.

$categories : array<string|int, mixed> = array()

The array of categories to remove.

Tags
throws
Sesha_Exception
Return values
int

the number of categories removed

delete()

Removes a stock entry from the backend. Also removes all related category and property information.

public abstract delete(int $stock_id) : bool
Parameters
$stock_id : int

The ID of the item to delete.

Tags
throws
Sesha_Exception
Return values
bool

True on success

deleteCategory()

Deletes a category.

public abstract deleteCategory(int $category_id) : int
Parameters
$category_id : int

The numeric ID of the category to delete. Also accepts Sesha_Entity_Category

Return values
int

The number of categories deleted

deleteProperty()

Deletes a property from the storage backend.

public abstract deleteProperty(int $property_id) : int
Parameters
$property_id : int

The numeric ID of the property to delete. Also accepts a Sesha_Inventory_Property object

Return values
int

Number of objects deleted.

findStock()

Inventory search

public abstract findStock([mixed $filters = array() ]) : array<string|int, mixed>
Parameters
$filters : mixed = array()
Return values
array<string|int, mixed>

List of Stock items

getCategories()

This function returns all the categories matching an id or category list.

public abstract getCategories([int $stock_id = null ][, int $category_ids = null ]) : array<string|int, mixed>
Parameters
$stock_id : int = null

The stock ID of categories to fetch. Overrides category_ids

$category_ids : int = null

The numeric IDs of the categories to find. If both $stock_id and $category_ids are null, all categories are returned

Return values
array<string|int, mixed>

The list of matching categories

getCategory()

This will return the category found matching a specific id.

public abstract getCategory(int|array<string|int, mixed> $category_id) : Sesha_Entity_Category
Parameters
$category_id : int|array<string|int, mixed>

The integer ID or key => value hash of the category to find.

Return values
Sesha_Entity_Category

The category on success

getProperties()

This will find all the available properties matching a specified IDs.

public abstract getProperties([array<string|int, mixed> $property_ids = array() ]) : array<string|int, mixed>
Parameters
$property_ids : array<string|int, mixed> = array()

The numeric ID of properties to find. Matches all properties when null.

Tags
throws
Sesha_Exception
Return values
array<string|int, mixed>

matching properties on success

getPropertiesForCategories()

This will return a set of properties for a set of specified categories.

public abstract getPropertiesForCategories([array<string|int, mixed> $categories = array() ]) : mixed
Parameters
$categories : array<string|int, mixed> = array()

The set of categories to fetch properties.

Tags
throws
Sesha_Exception
Return values
mixed

An array of properties on success

getPropertiesForStock()

Returns a set of properties for a particular stock ID number.

public abstract getPropertiesForStock(int $stock_id) : array<string|int, mixed>
Parameters
$stock_id : int

The numeric ID of the stock to find the properties for.

Tags
throws
Sesha_Exception
Return values
array<string|int, mixed>

of Sesha_Inventory_Property objects

getProperty()

Finds the first matching property for a specified property ID.

public abstract getProperty(int $property_id) : mixed
Parameters
$property_id : int

The numeric ID of properties to find.

Tags
throws
Sesha_Exception
Return values
mixed

The specified property on success

getValuesForStock()

Returns a set of Value Objects for a particular stock ID number.

public abstract getValuesForStock(int $stock_id) : array<string|int, mixed>
Parameters
$stock_id : int

The numeric ID of the stock to find the properties for. You can also pass a Sesha_Entity_Stock item

Tags
throws
Sesha_Exception
Return values
array<string|int, mixed>

the list of Sesha_Entity_Value objects

modify()

This function will modify a pre-existing stock entry with new values.

public abstract modify(mixed $stock_id, array<string|int, mixed> $stock) : bool
Parameters
$stock_id : mixed
$stock : array<string|int, mixed>

The hash of values for the inventory item.

Tags
throws
Sesha_Exception
Return values
bool

True on success.

setPropertiesForCategory()

Updates a category with a set of properties.

public abstract setPropertiesForCategory(int $category_id[, array<string|int, mixed> $properties = array() ]) : mixed
Parameters
$category_id : int

The numeric ID of the category to update.

$properties : array<string|int, mixed> = array()

An array of property ID's to add.

Tags
throws
Sesha_Exception
Return values
mixed

updateCategoriesForStock()

Updates the set of categories for a specified stock item.

public abstract updateCategoriesForStock(int $stock_id[, array<string|int, mixed> $categories = array() ]) : mixed
Parameters
$stock_id : int

The numeric stock ID to update.

$categories : array<string|int, mixed> = array()

The array of categories to change.

Return values
mixed

updateCategory()

Updates the attributes stored by a category.

public abstract updateCategory(array<string|int, mixed> $info) : int
Parameters
$info : array<string|int, mixed>

Updated category attributes.

Tags
throws
Sesha_Exception
Return values
int

Number of objects updated.

updatePropertiesForStock()

Updates the set of properties for a particular stock item.

public abstract updatePropertiesForStock(int $stock_id[, array<string|int, mixed> $properties = array() ]) : mixed
Parameters
$stock_id : int

The numeric ID of the stock to update.

$properties : array<string|int, mixed> = array()

The hash of properties to update.

Tags
throws
Sesha_Exception
Return values
mixed

updateProperty()

Updates a property with new attributes.

public abstract updateProperty(array<string|int, mixed> $info) : Sesha_Inventory_Property
Parameters
$info : array<string|int, mixed>

Array with updated property values.

Return values
Sesha_Inventory_Property

The changed Sesha_Inventory_Property object.

Search results