PageRenderTime 53ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/civicrm/CRM/Mailing/DAO/MailingJob.php

https://github.com/nysenate/Bluebird-CRM
PHP | 402 lines | 245 code | 26 blank | 131 comment | 4 complexity | dcba394e02e3f8a8e19efd0e5c8819a4 MD5 | raw file
Possible License(s): JSON, BSD-3-Clause, MPL-2.0-no-copyleft-exception, AGPL-1.0, GPL-2.0, AGPL-3.0, Apache-2.0, MIT, GPL-3.0, CC-BY-4.0, LGPL-2.1, BSD-2-Clause, LGPL-3.0
  1. <?php
  2. /**
  3. * @package CRM
  4. * @copyright CiviCRM LLC https://civicrm.org/licensing
  5. *
  6. * Generated from xml/schema/CRM/Mailing/MailingJob.xml
  7. * DO NOT EDIT. Generated by CRM_Core_CodeGen
  8. * (GenCodeChecksum:2527bca832d0e7751c69a42d33f28159)
  9. */
  10. /**
  11. * Database access object for the MailingJob entity.
  12. */
  13. class CRM_Mailing_DAO_MailingJob extends CRM_Core_DAO {
  14. const EXT = 'civicrm';
  15. const TABLE_ADDED = '';
  16. const COMPONENT = 'CiviMail';
  17. /**
  18. * Static instance to hold the table name.
  19. *
  20. * @var string
  21. */
  22. public static $_tableName = 'civicrm_mailing_job';
  23. /**
  24. * Should CiviCRM log any modifications to this table in the civicrm_log table.
  25. *
  26. * @var bool
  27. */
  28. public static $_log = FALSE;
  29. /**
  30. * @var int
  31. */
  32. public $id;
  33. /**
  34. * The ID of the mailing this Job will send.
  35. *
  36. * @var int
  37. */
  38. public $mailing_id;
  39. /**
  40. * date on which this job was scheduled.
  41. *
  42. * @var timestamp
  43. */
  44. public $scheduled_date;
  45. /**
  46. * date on which this job was started.
  47. *
  48. * @var timestamp
  49. */
  50. public $start_date;
  51. /**
  52. * date on which this job ended.
  53. *
  54. * @var timestamp
  55. */
  56. public $end_date;
  57. /**
  58. * The state of this job
  59. *
  60. * @var string
  61. */
  62. public $status;
  63. /**
  64. * Is this job for a test mail?
  65. *
  66. * @var bool
  67. */
  68. public $is_test;
  69. /**
  70. * Type of mailling job: null | child
  71. *
  72. * @var string
  73. */
  74. public $job_type;
  75. /**
  76. * Parent job id
  77. *
  78. * @var int
  79. */
  80. public $parent_id;
  81. /**
  82. * Offset of the child job
  83. *
  84. * @var int
  85. */
  86. public $job_offset;
  87. /**
  88. * Queue size limit for each child job
  89. *
  90. * @var int
  91. */
  92. public $job_limit;
  93. /**
  94. * Class constructor.
  95. */
  96. public function __construct() {
  97. $this->__table = 'civicrm_mailing_job';
  98. parent::__construct();
  99. }
  100. /**
  101. * Returns localized title of this entity.
  102. *
  103. * @param bool $plural
  104. * Whether to return the plural version of the title.
  105. */
  106. public static function getEntityTitle($plural = FALSE) {
  107. return $plural ? ts('Mailing Jobs') : ts('Mailing Job');
  108. }
  109. /**
  110. * Returns foreign keys and entity references.
  111. *
  112. * @return array
  113. * [CRM_Core_Reference_Interface]
  114. */
  115. public static function getReferenceColumns() {
  116. if (!isset(Civi::$statics[__CLASS__]['links'])) {
  117. Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
  118. Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'mailing_id', 'civicrm_mailing', 'id');
  119. Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_mailing_job', 'id');
  120. CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
  121. }
  122. return Civi::$statics[__CLASS__]['links'];
  123. }
  124. /**
  125. * Returns all the column names of this table
  126. *
  127. * @return array
  128. */
  129. public static function &fields() {
  130. if (!isset(Civi::$statics[__CLASS__]['fields'])) {
  131. Civi::$statics[__CLASS__]['fields'] = [
  132. 'id' => [
  133. 'name' => 'id',
  134. 'type' => CRM_Utils_Type::T_INT,
  135. 'title' => ts('Mailing Job ID'),
  136. 'required' => TRUE,
  137. 'where' => 'civicrm_mailing_job.id',
  138. 'table_name' => 'civicrm_mailing_job',
  139. 'entity' => 'MailingJob',
  140. 'bao' => 'CRM_Mailing_BAO_MailingJob',
  141. 'localizable' => 0,
  142. 'html' => [
  143. 'type' => 'Number',
  144. ],
  145. 'readonly' => TRUE,
  146. 'add' => NULL,
  147. ],
  148. 'mailing_id' => [
  149. 'name' => 'mailing_id',
  150. 'type' => CRM_Utils_Type::T_INT,
  151. 'title' => ts('Mailing ID'),
  152. 'description' => ts('The ID of the mailing this Job will send.'),
  153. 'required' => TRUE,
  154. 'where' => 'civicrm_mailing_job.mailing_id',
  155. 'table_name' => 'civicrm_mailing_job',
  156. 'entity' => 'MailingJob',
  157. 'bao' => 'CRM_Mailing_BAO_MailingJob',
  158. 'localizable' => 0,
  159. 'FKClassName' => 'CRM_Mailing_DAO_Mailing',
  160. 'html' => [
  161. 'label' => ts("Mailing"),
  162. ],
  163. 'add' => NULL,
  164. ],
  165. 'scheduled_date' => [
  166. 'name' => 'scheduled_date',
  167. 'type' => CRM_Utils_Type::T_TIMESTAMP,
  168. 'title' => ts('Mailing Scheduled Date'),
  169. 'description' => ts('date on which this job was scheduled.'),
  170. 'required' => FALSE,
  171. 'where' => 'civicrm_mailing_job.scheduled_date',
  172. 'default' => NULL,
  173. 'table_name' => 'civicrm_mailing_job',
  174. 'entity' => 'MailingJob',
  175. 'bao' => 'CRM_Mailing_BAO_MailingJob',
  176. 'localizable' => 0,
  177. 'html' => [
  178. 'type' => 'Select Date',
  179. 'formatType' => 'activityDateTime',
  180. ],
  181. 'add' => NULL,
  182. ],
  183. 'mailing_job_start_date' => [
  184. 'name' => 'start_date',
  185. 'type' => CRM_Utils_Type::T_TIMESTAMP,
  186. 'title' => ts('Mailing Job Start Date'),
  187. 'description' => ts('date on which this job was started.'),
  188. 'required' => FALSE,
  189. 'where' => 'civicrm_mailing_job.start_date',
  190. 'default' => NULL,
  191. 'table_name' => 'civicrm_mailing_job',
  192. 'entity' => 'MailingJob',
  193. 'bao' => 'CRM_Mailing_BAO_MailingJob',
  194. 'localizable' => 0,
  195. 'unique_title' => ts('Mailing Start Date'),
  196. 'html' => [
  197. 'type' => 'Select Date',
  198. 'formatType' => 'activityDateTime',
  199. ],
  200. 'add' => NULL,
  201. ],
  202. 'end_date' => [
  203. 'name' => 'end_date',
  204. 'type' => CRM_Utils_Type::T_TIMESTAMP,
  205. 'title' => ts('Mailing Job End Date'),
  206. 'description' => ts('date on which this job ended.'),
  207. 'required' => FALSE,
  208. 'where' => 'civicrm_mailing_job.end_date',
  209. 'default' => NULL,
  210. 'table_name' => 'civicrm_mailing_job',
  211. 'entity' => 'MailingJob',
  212. 'bao' => 'CRM_Mailing_BAO_MailingJob',
  213. 'localizable' => 0,
  214. 'html' => [
  215. 'type' => 'Select Date',
  216. 'formatType' => 'activityDateTime',
  217. ],
  218. 'add' => NULL,
  219. ],
  220. 'mailing_job_status' => [
  221. 'name' => 'status',
  222. 'type' => CRM_Utils_Type::T_STRING,
  223. 'title' => ts('Mailing Job Status'),
  224. 'description' => ts('The state of this job'),
  225. 'maxlength' => 12,
  226. 'size' => CRM_Utils_Type::TWELVE,
  227. 'where' => 'civicrm_mailing_job.status',
  228. 'table_name' => 'civicrm_mailing_job',
  229. 'entity' => 'MailingJob',
  230. 'bao' => 'CRM_Mailing_BAO_MailingJob',
  231. 'localizable' => 0,
  232. 'html' => [
  233. 'type' => 'Select',
  234. ],
  235. 'pseudoconstant' => [
  236. 'callback' => 'CRM_Core_SelectValues::getMailingJobStatus',
  237. ],
  238. 'add' => NULL,
  239. ],
  240. 'is_test' => [
  241. 'name' => 'is_test',
  242. 'type' => CRM_Utils_Type::T_BOOLEAN,
  243. 'title' => ts('Mailing Job Is Test?'),
  244. 'description' => ts('Is this job for a test mail?'),
  245. 'where' => 'civicrm_mailing_job.is_test',
  246. 'default' => '0',
  247. 'table_name' => 'civicrm_mailing_job',
  248. 'entity' => 'MailingJob',
  249. 'bao' => 'CRM_Mailing_BAO_MailingJob',
  250. 'localizable' => 0,
  251. 'add' => '1.9',
  252. ],
  253. 'job_type' => [
  254. 'name' => 'job_type',
  255. 'type' => CRM_Utils_Type::T_STRING,
  256. 'title' => ts('Mailing Job Type'),
  257. 'description' => ts('Type of mailling job: null | child '),
  258. 'maxlength' => 255,
  259. 'size' => CRM_Utils_Type::HUGE,
  260. 'where' => 'civicrm_mailing_job.job_type',
  261. 'table_name' => 'civicrm_mailing_job',
  262. 'entity' => 'MailingJob',
  263. 'bao' => 'CRM_Mailing_BAO_MailingJob',
  264. 'localizable' => 0,
  265. 'add' => '3.3',
  266. ],
  267. 'parent_id' => [
  268. 'name' => 'parent_id',
  269. 'type' => CRM_Utils_Type::T_INT,
  270. 'title' => ts('Parent ID'),
  271. 'description' => ts('Parent job id'),
  272. 'where' => 'civicrm_mailing_job.parent_id',
  273. 'default' => NULL,
  274. 'table_name' => 'civicrm_mailing_job',
  275. 'entity' => 'MailingJob',
  276. 'bao' => 'CRM_Mailing_BAO_MailingJob',
  277. 'localizable' => 0,
  278. 'FKClassName' => 'CRM_Mailing_DAO_MailingJob',
  279. 'html' => [
  280. 'label' => ts("Parent"),
  281. ],
  282. 'add' => '3.3',
  283. ],
  284. 'job_offset' => [
  285. 'name' => 'job_offset',
  286. 'type' => CRM_Utils_Type::T_INT,
  287. 'title' => ts('Mailing Job Offset'),
  288. 'description' => ts('Offset of the child job'),
  289. 'where' => 'civicrm_mailing_job.job_offset',
  290. 'default' => '0',
  291. 'table_name' => 'civicrm_mailing_job',
  292. 'entity' => 'MailingJob',
  293. 'bao' => 'CRM_Mailing_BAO_MailingJob',
  294. 'localizable' => 0,
  295. 'add' => '3.3',
  296. ],
  297. 'job_limit' => [
  298. 'name' => 'job_limit',
  299. 'type' => CRM_Utils_Type::T_INT,
  300. 'title' => ts('Mailing Job Limit'),
  301. 'description' => ts('Queue size limit for each child job'),
  302. 'where' => 'civicrm_mailing_job.job_limit',
  303. 'default' => '0',
  304. 'table_name' => 'civicrm_mailing_job',
  305. 'entity' => 'MailingJob',
  306. 'bao' => 'CRM_Mailing_BAO_MailingJob',
  307. 'localizable' => 0,
  308. 'add' => '3.3',
  309. ],
  310. ];
  311. CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
  312. }
  313. return Civi::$statics[__CLASS__]['fields'];
  314. }
  315. /**
  316. * Return a mapping from field-name to the corresponding key (as used in fields()).
  317. *
  318. * @return array
  319. * Array(string $name => string $uniqueName).
  320. */
  321. public static function &fieldKeys() {
  322. if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
  323. Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
  324. }
  325. return Civi::$statics[__CLASS__]['fieldKeys'];
  326. }
  327. /**
  328. * Returns the names of this table
  329. *
  330. * @return string
  331. */
  332. public static function getTableName() {
  333. return self::$_tableName;
  334. }
  335. /**
  336. * Returns if this table needs to be logged
  337. *
  338. * @return bool
  339. */
  340. public function getLog() {
  341. return self::$_log;
  342. }
  343. /**
  344. * Returns the list of fields that can be imported
  345. *
  346. * @param bool $prefix
  347. *
  348. * @return array
  349. */
  350. public static function &import($prefix = FALSE) {
  351. $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_job', $prefix, []);
  352. return $r;
  353. }
  354. /**
  355. * Returns the list of fields that can be exported
  356. *
  357. * @param bool $prefix
  358. *
  359. * @return array
  360. */
  361. public static function &export($prefix = FALSE) {
  362. $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_job', $prefix, []);
  363. return $r;
  364. }
  365. /**
  366. * Returns the list of indices
  367. *
  368. * @param bool $localize
  369. *
  370. * @return array
  371. */
  372. public static function indices($localize = TRUE) {
  373. $indices = [];
  374. return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
  375. }
  376. }