1Workflow::Persister::DBUIs:e:rExCtornatDraitbau(t3e)d PeWrolrkDfolcouwm:e:nPteartsiiosnter::DBI::ExtraData(3)
2
3
4

NAME

6       Workflow::Persister::DBI::ExtraData - Fetch extra data with each work‐
7       flow and put it into the context
8

SYNOPSIS

10        <persister name="MyPersister"
11                   class="Workflow::Persister::DBI::ExtraData"
12                   dsn="DBI:mysql:database=workflows"
13                   user="wf"
14                   password="mypass"
15                   extra_table="workflow_ticket"
16                   extra_data_field="ticket_id"
17                   extra_context_key="ticket_id"/>
18

DESCRIPTION

20       Overview
21
22       Simple subclass of Workflow::Persister::DBI to allow you to declare an
23       extra table and data field(s) from which to fetch data whenever you
24       fetch a workflow. There is a simple restriction: the table must have a
25       field 'workflow_id' of the same datatype as the 'workflow_id' field in
26       the 'workflow' table.
27
28       Examples
29
30        # Specify a single field 'ticket_id' from the table 'workflow_ticket'
31        # and store it in the context using the same key:
32
33        <persister
34            ...
35            extra_table="workflow_ticket"
36            extra_data_field="ticket_id"
37            ...
38
39        # How you would use this:
40        my $wf = FACTORY->fetch_workflow( 'Ticket', 55 );
41        print "Workflow is associated with ticket: ",
42              $wf->context->param( 'ticket_id' );
43
44        # Specify a single field 'ticket_id' from the table 'workflow_ticket'
45        # and store it in the context using a different key
46
47        <persister
48            ...
49            extra_table="workflow_ticket"
50            extra_data_field="ticket_id"
51            extra_context_key="THE_TICKET_ID"
52            ...
53
54        # How you would use this:
55        my $wf = FACTORY->fetch_workflow( 'Ticket', 55 );
56        print "Workflow is associated with ticket: ",
57              $wf->context->param( 'THE_TICKET_ID' );
58
59        # Specify multiple fields ('ticket_id', 'last_viewer',
60        # 'last_view_date') to pull from the 'workflow_ticket' table:
61
62        <persister
63            ...
64            extra_table="workflow_ticket"
65            extra_data_field="ticket_id,last_viewer,last_view_date"
66            ...
67
68        # How you would use this:
69        my $wf = FACTORY->fetch_workflow( 'Ticket', 55 );
70        print "Workflow is associated with ticket: ",
71              $wf->context->param( 'ticket_id' ), " ",
72              "which was last viewed by ",
73              $wf->context->param( 'last_viewer' ), " on ",
74              $wf->context->param( 'last_view_date' );
75
76       Configuration
77
78       extra_table (required)
79
80       Table where the extra data are kept.
81
82       extra_data_field (required)
83
84       Can be a single field or a comma-separated list of fields, all in the
85       same table. If a single field specified you have the option of declar‐
86       ing a different "extra_context_key" under which the value should be
87       stored in the workflow context. Otherwise the values are stored by the
88       field names in the workflow context.
89
90       extra_context_key (optional)
91
92       Key under which to save the data from "extra_data_field" in the work‐
93       flow context.
94
95       Note: this is ignored when you specify multiple fields in
96       "extra_data_field"; we just use the fieldnames for the context keys in
97       that case. And if you specify a single data field and do not specify a
98       context key we also use the data field name.
99
100       METHODS
101
102       #=head3 init
103
104       #=head3 fetch_extra_workflow_data
105
107       Copyright (c) 2003-2004 Chris Winters. All rights reserved.
108
109       This library is free software; you can redistribute it and/or modify it
110       under the same terms as Perl itself.
111

AUTHORS

113       Chris Winters <chris@cwinters.com>
114
115
116
117perl v5.8.8                       2007-04W-o2r5kflow::Persister::DBI::ExtraData(3)
Impressum