GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  DBIX::CLASS::TREE::ADJACENCYLIST::ORDERED (3)

.ds Aq ’

NAME

DBIx::Class::Tree::AdjacencyList::Ordered - Glue DBIx::Class::Ordered and DBIx::Class::Tree::AdjacencyList together.

CONTENTS

SYNOPSIS

Create a table for your tree data.



  CREATE TABLE items (
    item_id INTEGER PRIMARY KEY AUTOINCREMENT,
    parent_id INTEGER NOT NULL DEFAULT 0,
    position INTEGER NOT NULL,
    name TEXT NOT NULL
  );



In your Schema or DB class add Tree::AdjacencyList::Ordered to the front of the component list.



  __PACKAGE__->load_components(qw( Tree::AdjacencyList::Ordered ... ));



Specify the column that contains the parent ID and position of each row.



  package My::Employee;
  __PACKAGE__->position_column(position);
  __PACKAGE__->parent_column(parent_id);



This module provides a few extra methods beyond what DBIx::Class::Ordered and DBIx::Class::Tree::AdjacencyList already provide.



  my $parent = $item->parent();
  $item->parent( $parent_obj );
  $item->parent( $parent_id );
 
  my $children_rs = $item->children();
  my @children = $item->children();
 
  $parent->append_child( $child );
  $parent->prepend_child( $child );
 
  $this->attach_before( $that );
  $this->attach_after( $that );



DESCRIPTION

This module provides methods for working with adjacency lists and ordered rows. All of the methods that DBIx::Class::Ordered and DBIx::Class::Tree::AdjacencyList provide are available with this module.

METHODS

    parent_column



  __PACKAGE__->parent_column(parent_id);



Works the same as AdjacencyList’s parent_column() method, but it declares the children() has many relationship to be ordered by the position column.

    parent



  my $parent = $item->parent();
  $item->parent( $parent_obj );
  $item->parent( $parent_id );



This method overrides AdjacencyList’s parent() method but modifies it so that the object is moved to the last position, then the parent is changed, and then it is moved to the last position of the new list, thus maintaining the intergrity of the ordered lists.

    children



  my $children_rs = $item->children();
  my @children = $item->children();



This method works just like it does in the DBIx::Class::Tree::AdjacencyList module except it orders the children by there position.

    append_child



  $parent->append_child( $child );



Sets the child to have the specified parent and moves the child to the last position.

    prepend_child



  $parent->prepend_child( $child );



Sets the child to have the specified parent and moves the child to the first position.

    attach_before



  $this->attach_before( $that );



Attaches the object at the position just before the calling object’s position.

    attach_after



  $this->attach_after( $that );



Attaches the object at the position just after the calling object’s position.

INHERITED METHODS

    DBIx::Class::Ordered

o siblings
o first_sibling
o last_sibling
o previous_sibling
o next_sibling
o move_previous
o move_next
o move_first
o move_last
o move_to
o insert
o delete

    DBIx::Class::Tree::AdjacencyList

o parent_column
o parent
o attach_child
o siblings
o attach_sibling

    DBIx::Class

o mk_classdata
o component_base_class

    DBIx::Class::Componentised

o inject_base
o load_components
o load_own_components

    Class::Data::Accessor

o mk_classaccessor

AUTHOR

Aran Clary Deltac <bluefeet@cpan.org>

LICENSE

You may distribute this code under the same terms as Perl itself.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 DBIX::CLASS::TREE::ADJACENCYLIST::ORDERED (3) 2011-01-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.