NAME
Mango::Provider::Profiles - Provider class for user profile information
SYNOPSIS
my $provider = Mango::Provider::Profiles->new;
my $profile = $provider->get_by_id(23);
DESCRIPTION
Mango::Provider::Profiles is the provider class responsible for creating, deleting, updating and searching user profile information.
CONSTRUCTOR
new
Creates a new profile provider object. If options are passed to new, those are sent to setup
.
my $provider = Mango::Provider::Profiles->new;
See "new" in Mango::Provider and "new" in Mango::Provider::DBIC for a list of other possible options.
METHODS
create
Creates a new Mango::Profile object using the supplied data.
my $profile = $provider->create({
user => 23
first_name => 'Christopher',
last_name => 'Laco'
});
print $role->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 profile is assigned to.
my $profile = $provider->create({ user => $user, first_name => 'Christopher' });
It is recommended that you use this key, rather than setting the foreign key column manually in case it changes later.
delete
Deletes profiles 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::Profile object matching the specified id.
my $profile = $provider->get_by_id(23);
Returns undef if no matching profile can be found.
search
Returns a list of Mango::Profile objects in list context, or a Mango::Iterator in scalar context matching the specified filter.
my @profiles = $provider->search({
last_name => 'A%'
});
my $iterator = $provider->search({
last_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 @profiles = $provider->search({ user => $user }); my $profiles = $provider->search({ user => $user });
See "ATTRIBUTES" in DBIx::Class::Resultset for a list of other possible options.
update
Sets the 'updated' column to DateTime->now and saves any changes made to the profile back to the underlying store.
my $profile = $provider->create(\%data);
$profile->first_name('Christopher');
$provider->update($profile);
SEE ALSO
Mango::Provider, Mango::Provider::DBIC, Mango::Profile, DBIx::Class
AUTHOR
Christopher H. Laco
CPAN ID: CLACO
claco@chrislaco.com
http://today.icantfocus.com/blog/