1 | <?php |
||
5 | class SalesForceContact extends DataObject |
||
6 | { |
||
7 | |||
8 | private static $fields_to_send_to_sales_force = [ |
||
9 | 'FirstName', |
||
10 | 'LastName', |
||
11 | 'Email', |
||
12 | ]; |
||
13 | |||
14 | /** |
||
15 | * Singular name for CMS |
||
16 | * @var string |
||
17 | */ |
||
18 | private static $singular_name = 'Sales Force Contact'; |
||
19 | |||
20 | /** |
||
21 | * Plural name for CMS |
||
22 | * @var string |
||
23 | */ |
||
24 | private static $plural_name = 'Sales Force Contacts'; |
||
25 | |||
26 | /** |
||
27 | * SS4 prep! |
||
28 | * @var string |
||
29 | */ |
||
30 | private static $table_name = 'SalesForceContact'; |
||
31 | |||
32 | private static $db = [ |
||
33 | 'SalesForceIdentifier' => 'Varchar(40)', |
||
34 | 'FirstName' => 'Varchar(255)', |
||
35 | 'LastName' => 'Varchar(255)', |
||
36 | 'Email' => 'Varchar(255)', |
||
37 | 'SentToSalesForce' => 'Boolean', |
||
38 | 'CommsErrors' => 'Text', |
||
39 | ]; |
||
40 | |||
41 | |||
42 | private static $default_sort = [ |
||
43 | 'ID' => 'DESC' |
||
44 | ]; |
||
45 | |||
46 | /** |
||
47 | * Defines a default list of filters for the search context |
||
48 | * @var array |
||
49 | */ |
||
50 | private static $searchable_fields = [ |
||
51 | 'SentToSalesForce' => 'ExactMatchFilter', |
||
52 | 'SalesForceIdentifier' => 'PartialMatchField', |
||
53 | 'FirstName' => 'PartialMatchField', |
||
54 | 'LastName' => 'PartialMatchField', |
||
55 | 'Email' => 'PartialMatchField', |
||
56 | ]; |
||
57 | |||
58 | /** |
||
59 | * Defines summary fields commonly used in table columns |
||
60 | * as a quick overview of the data for this dataobject |
||
61 | * @var array |
||
62 | */ |
||
63 | private static $summary_fields = [ |
||
64 | 'SentToSalesForce' => 'Sent to SF', |
||
65 | 'SalesForceIdentifier' => 'SF ID', |
||
66 | 'FirstName' => 'First Name', |
||
67 | 'LastName' => 'Last Name', |
||
68 | 'Email' => 'Email', |
||
69 | ]; |
||
70 | |||
71 | private static $indexes = [ |
||
72 | 'Created' => true, |
||
73 | 'LastEdited' => true, |
||
74 | 'SentToSalesForce' => true, |
||
75 | 'SalesForceIdentifier' => true, |
||
76 | 'FirstName' => true, |
||
77 | 'LastName' => true, |
||
78 | 'Email' => true, |
||
79 | ]; |
||
80 | |||
81 | |||
82 | protected $onAfterWriteDone = false; |
||
83 | /** |
||
84 | * Event handler called after writing to the database. |
||
85 | */ |
||
86 | public function onAfterWrite() |
||
106 | } |
||
107 | } |
||
108 | } |
||
109 | } |
||
110 | |||
111 | protected function prepareFieldsToSendToSalesForce() |
||
122 | } |
||
123 | |||
124 | /** |
||
125 | * CMS Fields |
||
126 | * @return FieldList |
||
127 | */ |
||
128 | public function getCMSFields() |
||
163 | } |
||
164 | |||
165 | |||
166 | } |
||
167 |