Documentation

Sesha_Driver_Rdo extends Sesha_Driver
in package

This is the Rdo ORM implementation of the Sesha Driver.

Required values for $params:

'db'       The Horde_Db adapter

Copyright 2003-2017 Horde LLC (http://www.horde.org/) Based on the original Sql driver Copyright 2004-2007 Andrew Coleman mercury@appisolutions.net

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

Bo Daley bo@darkwork.net

author

Andrew Coleman mercury@appisolutions.net

author

Ralf Lang lang@b1-systems.de

Table of Contents

$_db  : DB
Handle for the database connection.
$_mappers  : Horde_Rdo_Factory
The mapper factory
$_params  : mixed
$_stock  : array<string|int, mixed>
Variable holding the items in the inventory.
__construct()  : mixed
This is the basic constructor for the Rdo driver.
add()  : Sesha_Entity_Stock
This will add a new item to the inventory.
addCategory()  : Sesha_Entity_Category
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 database. 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 database.
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

$_db

Handle for the database connection.

protected DB $_db
Tags
access

protected

$_mappers

The mapper factory

protected Horde_Rdo_Factory $_mappers
Tags
access

protected

$_params

protected mixed $_params

$_stock

Variable holding the items in the inventory.

protected array<string|int, mixed> $_stock

Methods

__construct()

This is the basic constructor for the Rdo driver.

public __construct([array<string|int, mixed> $params = array() ]) : mixed
Parameters
$params : array<string|int, mixed> = array()

Hash containing the connection parameters.

Return values
mixed

add()

This will add a new item to the inventory.

public 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.

addProperty()

Adds a new property to the storage backend.

public 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 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 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 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 database. Also removes all related category and property information.

public 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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