\Sesha_Driver

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.

Summary

Methods
Properties
Constants
__construct()
fetch()
delete()
add()
modify()
getCategory()
getCategories()
getProperties()
getProperty()
updateCategory()
addCategory()
deleteCategory()
categoryExists()
updateProperty()
addProperty()
deleteProperty()
getPropertiesForCategories()
setPropertiesForCategory()
clearPropertiesForCategory()
getPropertiesForStock()
getValuesForStock()
clearPropertiesForStock()
updatePropertiesForStock()
updateCategoriesForStock()
findStock()
No public properties found
No constants found
No protected methods found
$_params
$_stock
N/A
No private methods found
No private properties found
N/A

Properties

$_params

$_params : 

Type

$_stock

$_stock : array

Variable holding the items in the inventory.

Type

array

Methods

__construct()

__construct(  $params = array()) 

Parameters

$params

fetch()

fetch(integer  $stock_id) : \Sesha_Entity_Stock

This function retrieves a single stock item from the backend.

Parameters

integer $stock_id

The numeric ID of the stock item to fetch.

Throws

\Sesha_Exception

Returns

\Sesha_Entity_Stock

a stock item

delete()

delete(integer  $stock_id) : boolean

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

Parameters

integer $stock_id

The ID of the item to delete.

Throws

\Sesha_Exception

Returns

boolean —

True on success

add()

add(array  $stock) : \Sesha_Entity_Stock

This will add a new item to the inventory.

Parameters

array $stock

A hash of values for the stock item.

Throws

\Sesha_Exception

Returns

\Sesha_Entity_Stock

The newly added item or false.

modify()

modify(  $stock_id, array  $stock) : boolean

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

Parameters

$stock_id
array $stock

The hash of values for the inventory item.

Throws

\Sesha_Exception

Returns

boolean —

True on success.

getCategory()

getCategory(integer|array  $category_id) : \Sesha_Entity_Category

This will return the category found matching a specific id.

Parameters

integer|array $category_id

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

Returns

\Sesha_Entity_Category

The category on success

getCategories()

getCategories(integer  $stock_id = null, integer  $category_ids = null) : array

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

Parameters

integer $stock_id

The stock ID of categories to fetch. Overrides category_ids

integer $category_ids

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

Returns

array —

The list of matching categories

getProperties()

getProperties(array  $property_ids = array()) : array

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

Parameters

array $property_ids

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

Throws

\Sesha_Exception

Returns

array —

matching properties on success

getProperty()

getProperty(integer  $property_id) : mixed

Finds the first matching property for a specified property ID.

Parameters

integer $property_id

The numeric ID of properties to find.

Throws

\Sesha_Exception

Returns

mixed —

The specified property on success

updateCategory()

updateCategory(array  $info) : integer

Updates the attributes stored by a category.

Parameters

array $info

Updated category attributes.

Throws

\Sesha_Exception

Returns

integer —

Number of objects updated.

addCategory()

addCategory(array  $info) : integer

Adds a new category for classifying inventory.

Parameters

array $info

The new category's attributes.

Throws

\Sesha_Exception

Returns

integer —

The ID of the new of the category on success

deleteCategory()

deleteCategory(integer  $category_id) : integer

Deletes a category.

Parameters

integer $category_id

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

Returns

integer —

The number of categories deleted

categoryExists()

categoryExists(string  $category) : boolean

Determines if a category exists in the storage backend.

Parameters

string $category

The string representation of the category to find.

Returns

boolean —

True on success; false otherwise.

updateProperty()

updateProperty(array  $info) : \Sesha_Inventory_Property

Updates a property with new attributes.

Parameters

array $info

Array with updated property values.

Returns

\Sesha_Inventory_Property —

The changed Sesha_Inventory_Property object.

addProperty()

addProperty(array  $info) : \Sesha_Entity_Property

Adds a new property to the storage backend.

Parameters

array $info

Array with new property values.

Returns

\Sesha_Entity_Property

deleteProperty()

deleteProperty(integer  $property_id) : integer

Deletes a property from the storage backend.

Parameters

integer $property_id

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

Returns

integer —

Number of objects deleted.

getPropertiesForCategories()

getPropertiesForCategories(array  $categories = array()) : mixed

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

Parameters

array $categories

The set of categories to fetch properties.

Throws

\Sesha_Exception

Returns

mixed —

An array of properties on success

setPropertiesForCategory()

setPropertiesForCategory(integer  $category_id, array  $properties = array()) 

Updates a category with a set of properties.

Parameters

integer $category_id

The numeric ID of the category to update.

array $properties

An array of property ID's to add.

Throws

\Sesha_Exception

clearPropertiesForCategory()

clearPropertiesForCategory(integer  $category_id) : integer

Removes all properties for a specified category.

Parameters

integer $category_id

The numeric ID of the category to update.

Throws

\Sesha_Exception

Returns

integer —

The number of deleted properties

getPropertiesForStock()

getPropertiesForStock(integer  $stock_id) : array

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

Parameters

integer $stock_id

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

Throws

\Sesha_Exception

Returns

array —

of Sesha_Inventory_Property objects

getValuesForStock()

getValuesForStock(integer  $stock_id) : array

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

Parameters

integer $stock_id

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

Throws

\Sesha_Exception

Returns

array —

the list of Sesha_Entity_Value objects

clearPropertiesForStock()

clearPropertiesForStock(integer  $stock_id, array  $categories = array()) : integer

Removes categories from a particular stock item.

Parameters

integer $stock_id

The numeric ID of the stock item to update.

array $categories

The array of categories to remove.

Throws

\Sesha_Exception

Returns

integer —

the number of categories removed

updatePropertiesForStock()

updatePropertiesForStock(integer  $stock_id, array  $properties = array()) 

Updates the set of properties for a particular stock item.

Parameters

integer $stock_id

The numeric ID of the stock to update.

array $properties

The hash of properties to update.

Throws

\Sesha_Exception

updateCategoriesForStock()

updateCategoriesForStock(integer  $stock_id, array  $categories = array()) 

Updates the set of categories for a specified stock item.

Parameters

integer $stock_id

The numeric stock ID to update.

array $categories

The array of categories to change.

findStock()

findStock(  $filters = array()) : array

Inventory search

Parameters

$filters

Returns

array —

List of Stock items