load()store()count()
Class::Persist::Collection
my $collection = Class::Persist::Collection->new(); $collection->owner($owner); $collection->push($object1, $object2); $collection->store(); $obj1 = $collection->[0];
Class::Persist::Collection objects serve as the intermediate step between Class::Persist objects and their children in a has_many relationship. They can be deferenced as arrays, and will inflate their children from proxes as required.
Class::Persist::Base
A collection has an owner - this is the owner that all the members of the collection have.
When called for the first time, create an array of proxies representing the real objects. Returns a listref of the children of the collection.
load()Replace all the element by proxies
store()Store any non proxy element in the collection and proxy it
count()returns the number of elements in the collection
add an element to the end of the collection
add an element to the beginning of the collection
Without parameter, delete all the elements of the collection. If an index is given, deletes the related element.
Deletes elements recursively.
reverts either the given element (if index is passed) or all elements (if not).
With an index, clones and returns the clone of the indexed element. Without, returns a Class::Persist::Collection that is a clone of itself, containing clones of all its elements.
new_owner is the object that will own the new collection, and must be passed.
Class::Persist