NAME
Mango::Provider::Wishlists - Provider class for wishlist information
SYNOPSIS
my $provider = Mango::Provider::Wishlists->new;
my $wishlist = $provider->get_by_id(23);
DESCRIPTION
Mango::Provider::Wishlists is the provider class responsible for creating, deleting, updating and searching wishlist information.
CONSTRUCTOR
new
Creates a new wishlist provider object. If options are passed to new, those are sent to setup
.
my $provider = Mango::Provider::Wishlists->new;
See "new" in Mango::Provider for a list of other possible options.
METHODS
create
Creates a new Mango::Wishlist object using the supplied data.
my $wishlist = $provider->create({
user => 23
});
print $wishlist->name;
In addition to using the column names, the following special keys are available:
- user
-
This can be a user id, or a user object for which this cart is assigned to.
my $wishlist = $provider->create({ user => $user });
It is recommended that you use this key, rather than setting the foreign key column manually in case it changes later.
delete
Deletes wishlists from the provider matching the supplied filter.
$provider->delete({
id => 23
});
In addition to using the column names, the following special keys are available:
- user
-
This can be a user id, or a user object for which this profile is assigned to.
$provider->delete({ user => $user });
It is recommended that you use this key, rather than setting the foreign key column manually in case it changes later.
get_by_id
Returns a Mango::Wishlist object matching the specified id.
my $wishlist = $provider->get_by_id(23);
Returns undef if no matching wishlist can be found.
search
Returns a list of Mango::Wishlist objects in list context, or a Mango::Iterator in scalar context matching the specified filter.
my @wishlists = $provider->search({
name => 'A%'
});
my $iterator = $provider->search({
name => 'A%'
});
In addition to using the column names, the following special keys are available:
- user
-
This can be a user id, or a user object for which roles are assigned to.
my @wishlists = $provider->search({ user => $user }); my $wishlists = $provider->search({ user => $user });
See "search" in Handel::Cart for a list of other possible options.
update
Sets the 'updated' column to DateTime->now and saves any changes made to the wishlist back to the underlying store.
my $wishlist = $provider->create(\%data);
$wishlist->name('Favorites');
$provider->update($wishlist);
SEE ALSO
Mango::Provider, Mango::Wishlist, Handel::Cart
AUTHOR
Christopher H. Laco
CPAN ID: CLACO
claco@chrislaco.com
http://today.icantfocus.com/blog/