3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2020 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
30 * @copyright CiviCRM LLC (c) 2004-2020
32 * Generated from xml/schema/CRM/Omnimail/MailingProviderData.xml
33 * DO NOT EDIT. Generated by CRM_Core_CodeGen
34 * (GenCodeChecksum:a204d62995809fae79a76799b88a69f8)
38 * CRM_Omnimail_DAO_MailingProviderData constructor.
40 class CRM_Omnimail_DAO_MailingProviderData
extends CRM_Core_DAO
{
42 * Static instance to hold the table name.
46 protected static $_tableName = 'civicrm_mailing_provider_data';
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
52 protected static $_log = FALSE;
54 * External reference for the contact
58 public $contact_identifier;
60 * External Reference for the mailing
64 public $mailing_identifier;
78 * When the action happened
82 public $recipient_action_datetime;
90 * Has the action been synchronised through to CiviCRM
94 public $is_civicrm_updated;
99 public function __construct() {
100 $this->__table
= 'civicrm_mailing_provider_data';
101 parent
::__construct();
105 * Returns all the column names of this table
109 public static function &fields() {
110 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
111 Civi
::$statics[__CLASS__
]['fields'] = [
112 'contact_identifier' => [
113 'name' => 'contact_identifier',
114 'type' => CRM_Utils_Type
::T_STRING
,
115 'title' => ts('Contact Identifier') ,
116 'description' => 'External reference for the contact',
118 'size' => CRM_Utils_Type
::HUGE
,
119 'table_name' => 'civicrm_mailing_provider_data',
120 'entity' => 'MailingProviderData',
121 'bao' => 'CRM_Omnimail_DAO_MailingProviderData',
124 'mailing_identifier' => [
125 'name' => 'mailing_identifier',
126 'type' => CRM_Utils_Type
::T_STRING
,
127 'title' => ts('Mailing Identifier') ,
128 'description' => 'External Referencefor the mailing',
130 'size' => CRM_Utils_Type
::HUGE
,
131 'table_name' => 'civicrm_mailing_provider_data',
132 'entity' => 'MailingProviderData',
133 'bao' => 'CRM_Omnimail_DAO_MailingProviderData',
138 'type' => CRM_Utils_Type
::T_STRING
,
139 'title' => ts('Email') ,
140 'description' => 'Email Address',
142 'size' => CRM_Utils_Type
::HUGE
,
143 'table_name' => 'civicrm_mailing_provider_data',
144 'entity' => 'MailingProviderData',
145 'bao' => 'CRM_Omnimail_DAO_MailingProviderData',
149 'name' => 'event_type',
150 'type' => CRM_Utils_Type
::T_STRING
,
151 'title' => ts('Recipient Action Type') ,
152 'description' => 'Type of action',
154 'size' => CRM_Utils_Type
::HUGE
,
155 'table_name' => 'civicrm_mailing_provider_data',
156 'entity' => 'MailingProviderData',
157 'bao' => 'CRM_Omnimail_DAO_MailingProviderData',
160 'recipient_action_datetime' => [
161 'name' => 'recipient_action_datetime',
162 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
163 'title' => ts('Recipient Action Datetime') ,
164 'description' => 'When the action happened',
165 'table_name' => 'civicrm_mailing_provider_data',
166 'entity' => 'MailingProviderData',
167 'bao' => 'CRM_Omnimail_DAO_MailingProviderData',
171 'name' => 'contact_id',
172 'type' => CRM_Utils_Type
::T_INT
,
173 'description' => 'Contact in CiviCRM',
174 'table_name' => 'civicrm_mailing_provider_data',
175 'entity' => 'MailingProviderData',
176 'bao' => 'CRM_Omnimail_DAO_MailingProviderData',
179 'is_civicrm_updated' => [
180 'name' => 'is_civicrm_updated',
181 'type' => CRM_Utils_Type
::T_BOOLEAN
,
182 'description' => 'Has the action been synchronised through to CiviCRM',
183 'table_name' => 'civicrm_mailing_provider_data',
184 'entity' => 'MailingProviderData',
185 'bao' => 'CRM_Omnimail_DAO_MailingProviderData',
189 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
191 return Civi
::$statics[__CLASS__
]['fields'];
195 * Return a mapping from field-name to the corresponding key (as used in fields()).
198 * Array(string $name => string $uniqueName).
200 public static function &fieldKeys() {
201 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
202 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
204 return Civi
::$statics[__CLASS__
]['fieldKeys'];
208 * Returns the names of this table
212 public static function getTableName() {
213 return self
::$_tableName;
217 * Returns if this table needs to be logged
221 public function getLog() {
226 * Returns the list of fields that can be imported
228 * @param bool $prefix
232 public static function &import($prefix = FALSE) {
233 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'mailing_provider_data', $prefix, []);
238 * Returns the list of fields that can be exported
240 * @param bool $prefix
244 public static function &export($prefix = FALSE) {
245 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'mailing_provider_data', $prefix, []);
250 * Returns the list of indices
252 public static function indices($localize = TRUE) {
254 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;
260 * CRM_Omnimail_BAO_MailingProviderData constructor.
262 class CRM_Omnimail_BAO_MailingProviderData
extends CRM_Omnimail_DAO_MailingProviderData
{
267 * MailingProviderData.get API
269 * @param array $params
270 * @return array API result descriptor
271 * @throws API_Exception
273 function civicrm_api3_mailing_provider_data_get($params) {
274 $sql = CRM_Utils_SQL_Select
::fragment();
275 $sql->select('CONCAT(contact_identifier, mailing_identifier, recipient_action_datetime) as id');
276 return civicrm_api3_create_success(_civicrm_api3_basic_get('CRM_Omnimail_BAO_MailingProviderData', $params, FALSE, 'MailingProviderData', $sql, FALSE));
280 * Metadata for MailingProviderData.get API
282 * @param array $params
284 * @throws API_Exception
286 function _civicrm_api3_mailing_provider_data_get_spec(&$params) {
287 $params['mailing_identifier']['FKClassName'] = 'CRM_Mailing_BAO_Mailing';
288 $params['mailing_identifier']['FKApiName'] = 'Mailing';
289 $params['mailing_identifier']['FKKeyColumn'] = 'hash';
293 * MailingProviderData.create API
295 * @param array $params
296 * @return array API result descriptor
297 * @throws API_Exception
299 function civicrm_api3_mailing_provider_data_create($params) {
300 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__
), $params);