ZenMagick 0.9.1


org.zenmagick.service.ZMCategories

Class ZMCategories

ZMObject
|
+--ZMCategories

public class ZMCategories
extends ZMObject

Category DAO.

Author:
mano
Version:
$Id: ZMCategories.php 1107 2008-05-15 03:27:18Z DerManoMann $

Field Summary
static mixed

$CATEGORY_DESCRIPTION_MAPPING

static mixed

$CATEGORY_MAPPING

static mixed

$PRODUCTS_TO_CATEGORIES_MAPPING

Constructor Summary

ZMCategories(int languageId)

Create new instance.

Method Summary
protected void

buildTree(int languageId)

Create tree data.

Category

createCategory(ZMCategory category)

Create a new category.

array

getCategories(array ids, int languageId)

Get all categories.

ZMCategory

getCategoryForId(int categoryId, int languageId)

Get a category for the given id.

array

getCategoryTree(int languageId)

This returns, in fact, not a real tree, but a list of all top level categories.

ZMCategory

getDefaultCategoryForProductId(int productId, int languageId)

Get the default category for the given product id.

static void

instance()

Get instance.

protected void

load(int languageId)

Load all categories.

Category

updateCategory(ZMCategory category)

Update an existing category.

Methods inherited from org.zenmagick.ZMObject
backtrace, create, log, singleton

Field Detail

CATEGORY_DESCRIPTION_MAPPING

public static mixed $CATEGORY_DESCRIPTION_MAPPING = null

CATEGORY_MAPPING

public static mixed $CATEGORY_MAPPING = null

PRODUCTS_TO_CATEGORIES_MAPPING

public static mixed $PRODUCTS_TO_CATEGORIES_MAPPING = null

Constructor Detail

ZMCategories

public ZMCategories(int languageId)

Create new instance.

Parameters:
languageId - The languageId; default is null for session language.

Method Detail

buildTree

protected void buildTree(int languageId)

Create tree data.

Parameters:
languageId - Optional language id; default is null.

createCategory

public Category createCategory(ZMCategory category)

Create a new category.

Parameters:
category - The category.
Returns:
The updated category.

getCategories

public array getCategories(array ids, int languageId)

Get all categories.

Parameters:
ids - Optional list of category ids.
languageId - Optional language id; default is null.
Returns:
A list of ZMCategory instances.

getCategoryForId

public ZMCategory getCategoryForId(int categoryId, int languageId)

Get a category for the given id.

Parameters:
categoryId - The category id.
languageId - Optional language id; default is null.
Returns:
A ZMCategory instance or null.

getCategoryTree

public array getCategoryTree(int languageId)

This returns, in fact, not a real tree, but a list of all top level categories.

Parameters:
languageId - Optional language id; default is null.
Returns:
A list of all top level categories (parentId == 0).

getDefaultCategoryForProductId

public ZMCategory getDefaultCategoryForProductId(int productId, int languageId)

Get the default category for the given product id.

This will return the first mapped category.

Parameters:
productId - The product id.
languageId - Optional language id; default is null.
Returns:
The default category (or null).

instance

public static void instance()

Get instance. /


load

protected void load(int languageId)

Load all categories.

Parameters:
languageId - Optional language id; default is null.

updateCategory

public Category updateCategory(ZMCategory category)

Update an existing category.

Parameters:
category - The category.
Returns:
The updated category.

ZenMagick 0.9.1