NAME
RapidApp::DirectLink::LinkFactory
SYNOPSIS
CREATE TABLE direct_link (
create_date DATE NOT NULL,
random_hash char(8) NOT NULL,
params varchar(255) NOT NULL,
);
...
my $directLinks= RapidApp::DirectLink::LinkFactory(schema => $self->c->model("DB"));
my $directLinks= RapidApp::DirectLink::LinkFactory(schema => $self->c->model("DB"), directLinkSourceName => 'MyDirectLink');
# careful, this one binds the LinkFactory to a catalyst instance
my $directLinks= RapidApp::DirectLink::LinkFactory(directLinkRS => sub { $self->c->model("DB::DirectLink") });
my $link= $directLinks->create(auth => { user => $contact_id, acl => { etc } }, targetUrl => 'foo/bar');
my $link= $directLinks->load(linkUid => $self->c->request->params->{id});
DESCRIPTION
This class provides methods for creating, retrieving, and cleaning DirectLinks.
It requires a ResultSource with the following definition: create_date DATE NOT NULL, random_hash char(8) NOT NULL, params varchar(255) NOT NULL,
By default, it looks for a ResultSource named 'DirectLink', though this is configurable.
ATTRIBUTES
- schema
-
Some object which can "->source($name)". Will usually be a DBIx::Class::Schema.
- directLinkSourceName
-
The name of the result source to use, if using the 'schema' attribute.
- directLinkRS
-
Either an instance of DBIx::Class::ResultSource, or a coderef which returns one when evaluated with no arguments.
If directLinkRS is given, schema and directLinkSourceName will be ignored.
METHODS
createLink
Create a new DirectLink from supplied parameters. Most of the parameters will become part of a hash which gets serialized into a JSON string, so make sure they are serializable.
This function takes care of ensuring that the current date and a unique hash are chosen.
The parameters may be anything that is valid for the constructor of DirectLink::Link.
loadByUid
Load a link from the database via its unique ID. This is used when the user follows a hyperlink to the DirectLink::Redirector controller.
SEE ALSO
RapidApp::DirectLink::LinkFactory
RapidApp::DirectLink::Link
RapidApp::DirectLink::SessionLoader
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 74:
You forgot a '=back' before '=head1'