Commit | Line | Data |
---|---|---|
92f656cb TO |
1 | <?php |
2 | ||
3 | /* | |
4 | +--------------------------------------------------------------------+ | |
5 | | Copyright CiviCRM LLC. All rights reserved. | | |
6 | | | | |
7 | | This work is published under the GNU AGPLv3 license with some | | |
8 | | permitted exceptions and without any warranty. For full license | | |
9 | | and copyright information, see https://civicrm.org/licensing | | |
10 | +--------------------------------------------------------------------+ | |
11 | */ | |
12 | ||
13 | namespace Civi\WorkflowMessage; | |
14 | ||
15 | use Civi\Schema\Traits\MagicGetterSetterTrait; | |
16 | use Civi\WorkflowMessage\Traits\ReflectiveWorkflowTrait; | |
17 | ||
18 | /** | |
19 | * Generic base-class for describing the inputs for a workflow email template. | |
20 | * | |
21 | * @method $this setContactId(int|null $contactId) | |
22 | * @method int|null getContactId() | |
23 | */ | |
24 | class GenericWorkflowMessage implements WorkflowMessageInterface { | |
25 | ||
26 | // Implement getFields(), import(), export(), validate() - All methods based on inspecting class properties (`ReflectionClass`). | |
27 | // Define stub methods exportExtraTokenContext(), exportExtraTplParams(), etc. | |
28 | use ReflectiveWorkflowTrait; | |
29 | ||
30 | // Implement __call() - Public and protected properties are automatically given a default getter/setter. These may be overridden/customized. | |
31 | use MagicGetterSetterTrait; | |
32 | ||
33 | /** | |
34 | * WorkflowMessage constructor. | |
35 | * | |
36 | * @param array $imports | |
37 | * List of values to import. | |
38 | * Ex: ['tplParams' => [...tplValues...], 'tokenContext' => [...tokenData...]] | |
39 | * Ex: ['modelProps' => [...classProperties...]] | |
40 | */ | |
41 | public function __construct(array $imports = []) { | |
42 | WorkflowMessage::importAll($this, $imports); | |
43 | } | |
44 | ||
45 | /** | |
46 | * The contact receiving this message. | |
47 | * | |
48 | * @var int | |
49 | * @scope tokenContext | |
50 | */ | |
51 | protected $contactId; | |
52 | ||
53 | } |