Liz::CategorySet::Category - module for Category objects of the CategorySet
use Liz::CategorySet; $categoryset = new Liz::CategorySet;
$category = $categoryset->Category; $category = $categoryset->Category( $categoryID );
$category->update;
Provide object oriented access to categories in a CategorySet. Usually not accessed directly, but rather through the Liz::CategorySet object and its Category method.
Create a new Category object from a CategorySet object.
1 Liz::CategorySet object 2 ID/name to created Category object with (default: none = new category) 3 ID of parent category (default: 0 = top) 4 sortname of category (name of which category should be sorted) (default: same as name if 2nd parameter is name)
1 instantiated object
It is not intended to call this method directly, but rather indirectly through the Liz::CategorySet module.
$categoryset = new Liz::CategorySet; $category = $categoryset->Category( 'Toilet Seats',$accessoriesID ); $category = $categoryset->Category( $categoryID );
Update a Category object in the Liz::CategorySet database.
1 ID with which the object was updated (undef = error)
$category->update;
Delete a Liz::CategorySet::Category object from the database.
1 flag: whether action was successful
$category->delete;
Reset all category information in the categoryset.
$categoryset->reset; print "All categories have been removed\n";
The following methods allow you to inspect and/or change certain fields of the Liz::CategorySet::Category object.
Returns the Depth of the Category (top level = 0). The Depth of a Category is automatically maintained by the module and can not be changed.
1 depth of category (0 = top level category)
Set/Return the name of the Category.
1 new name (default: no change)
1 current/previous name
$category->Name( $name ); $name = $category->Name;
Return the direct parentID of the Category object.
1 new parentID (default: no change)
1 previous/current parent ID
$category->ParentID( $parentID ); $parentID = $category->ParentID;
Returns all parentIDs of the current category object
1..N ID's of all parents
(empty list of no parents found)
The following methods are AUTOLOADed: they can be used to change fields in the object or add values to already existing fields. Prefix values with ``+='' to append to existing values.
These methods do not exist in this module but are allowed to be executed on the object:
Created Data ForeignKey ID Name Options SortName Status Updated
Elizabeth Mattijsen ( lizperl@INC.nl )
Contributions by:
- Ronald Lens ( ronald@xxLINK.nl )
(C) 1998-1999 International Network Consultants
Reverted changes of 4 October: problem with sortname now properly being set by update if empty.
Added own method ParentID, as the inherited method was not correct.
Fiddled with new method to make sure a new object doesn't overwrite and existing one.
Now has own method Name to bypass the Name method of Liz::CategorySet.
Now inherits from Liz::Categoryset.pm instead of Liz::SQL.pm.
Now no longer puts Exporter in ISA: wasn't needed.
Fixed problem with unescaped sortname in update.
Method update now limits the size of the sortname field to 255 characters.
Updated methods new and update so that this module can be sub-classed with extra fields.
Changed method new so that the global variable $ERROR is set if the obtaining of
an existing record failed.
Updated typography of the source to the new indented format.
Fixed problem in method update which would not return the ID of the object if the object was not changed.
Support for Data added.
Support for ForeignKey added.
Support for Alternates added.
Reduced memory footprint by fully qualifying global variables.
Method update now returns the ID with which the object was created.
Support for Status added.
First version of this true Perl module.