PageRenderTime 64ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/package/app/app/alpha/lib/model/om/Basenotification.php

https://bitbucket.org/pandaos/kaltura
PHP | 1908 lines | 981 code | 245 blank | 682 comment | 169 complexity | 4a2f1f836cc9c8f08ebcbb518dd8bf8b MD5 | raw file
Possible License(s): AGPL-3.0, GPL-3.0, BSD-3-Clause, LGPL-2.1, GPL-2.0, LGPL-3.0, JSON, MPL-2.0-no-copyleft-exception, Apache-2.0

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /**
  3. * Base class that represents a row from the 'notification' table.
  4. *
  5. *
  6. *
  7. * @package Core
  8. * @subpackage model.om
  9. */
  10. abstract class Basenotification extends BaseObject implements Persistent {
  11. /**
  12. * The Peer class.
  13. * Instance provides a convenient way of calling static methods on a class
  14. * that calling code may not be able to identify.
  15. * @var notificationPeer
  16. */
  17. protected static $peer;
  18. /**
  19. * The value for the id field.
  20. * @var int
  21. */
  22. protected $id;
  23. /**
  24. * The value for the partner_id field.
  25. * @var int
  26. */
  27. protected $partner_id;
  28. /**
  29. * The value for the puser_id field.
  30. * @var string
  31. */
  32. protected $puser_id;
  33. /**
  34. * The value for the type field.
  35. * @var int
  36. */
  37. protected $type;
  38. /**
  39. * The value for the object_id field.
  40. * @var string
  41. */
  42. protected $object_id;
  43. /**
  44. * The value for the status field.
  45. * @var int
  46. */
  47. protected $status;
  48. /**
  49. * The value for the notification_data field.
  50. * @var string
  51. */
  52. protected $notification_data;
  53. /**
  54. * The value for the number_of_attempts field.
  55. * Note: this column has a database default value of: 0
  56. * @var int
  57. */
  58. protected $number_of_attempts;
  59. /**
  60. * The value for the created_at field.
  61. * @var string
  62. */
  63. protected $created_at;
  64. /**
  65. * The value for the updated_at field.
  66. * @var string
  67. */
  68. protected $updated_at;
  69. /**
  70. * The value for the notification_result field.
  71. * @var string
  72. */
  73. protected $notification_result;
  74. /**
  75. * The value for the object_type field.
  76. * @var int
  77. */
  78. protected $object_type;
  79. /**
  80. * The value for the scheduler_id field.
  81. * @var int
  82. */
  83. protected $scheduler_id;
  84. /**
  85. * The value for the worker_id field.
  86. * @var int
  87. */
  88. protected $worker_id;
  89. /**
  90. * The value for the batch_index field.
  91. * @var int
  92. */
  93. protected $batch_index;
  94. /**
  95. * The value for the processor_expiration field.
  96. * @var string
  97. */
  98. protected $processor_expiration;
  99. /**
  100. * The value for the execution_attempts field.
  101. * @var int
  102. */
  103. protected $execution_attempts;
  104. /**
  105. * The value for the lock_version field.
  106. * @var int
  107. */
  108. protected $lock_version;
  109. /**
  110. * The value for the dc field.
  111. * @var string
  112. */
  113. protected $dc;
  114. /**
  115. * Flag to prevent endless save loop, if this object is referenced
  116. * by another object which falls in this transaction.
  117. * @var boolean
  118. */
  119. protected $alreadyInSave = false;
  120. /**
  121. * Flag to prevent endless validation loop, if this object is referenced
  122. * by another object which falls in this transaction.
  123. * @var boolean
  124. */
  125. protected $alreadyInValidation = false;
  126. /**
  127. * Store columns old values before the changes
  128. * @var array
  129. */
  130. protected $oldColumnsValues = array();
  131. /**
  132. * @return array
  133. */
  134. public function getColumnsOldValues()
  135. {
  136. return $this->oldColumnsValues;
  137. }
  138. /**
  139. * Applies default values to this object.
  140. * This method should be called from the object's constructor (or
  141. * equivalent initialization method).
  142. * @see __construct()
  143. */
  144. public function applyDefaultValues()
  145. {
  146. $this->number_of_attempts = 0;
  147. }
  148. /**
  149. * Initializes internal state of Basenotification object.
  150. * @see applyDefaults()
  151. */
  152. public function __construct()
  153. {
  154. parent::__construct();
  155. $this->applyDefaultValues();
  156. }
  157. /**
  158. * Get the [id] column value.
  159. *
  160. * @return int
  161. */
  162. public function getId()
  163. {
  164. return $this->id;
  165. }
  166. /**
  167. * Get the [partner_id] column value.
  168. *
  169. * @return int
  170. */
  171. public function getPartnerId()
  172. {
  173. return $this->partner_id;
  174. }
  175. /**
  176. * Get the [puser_id] column value.
  177. *
  178. * @return string
  179. */
  180. public function getPuserId()
  181. {
  182. return $this->puser_id;
  183. }
  184. /**
  185. * Get the [type] column value.
  186. *
  187. * @return int
  188. */
  189. public function getType()
  190. {
  191. return $this->type;
  192. }
  193. /**
  194. * Get the [object_id] column value.
  195. *
  196. * @return string
  197. */
  198. public function getObjectId()
  199. {
  200. return $this->object_id;
  201. }
  202. /**
  203. * Get the [status] column value.
  204. *
  205. * @return int
  206. */
  207. public function getStatus()
  208. {
  209. return $this->status;
  210. }
  211. /**
  212. * Get the [notification_data] column value.
  213. *
  214. * @return string
  215. */
  216. public function getNotificationData()
  217. {
  218. return $this->notification_data;
  219. }
  220. /**
  221. * Get the [number_of_attempts] column value.
  222. *
  223. * @return int
  224. */
  225. public function getNumberOfAttempts()
  226. {
  227. return $this->number_of_attempts;
  228. }
  229. /**
  230. * Get the [optionally formatted] temporal [created_at] column value.
  231. *
  232. * This accessor only only work with unix epoch dates. Consider enabling the propel.useDateTimeClass
  233. * option in order to avoid converstions to integers (which are limited in the dates they can express).
  234. *
  235. * @param string $format The date/time format string (either date()-style or strftime()-style).
  236. * If format is NULL, then the raw unix timestamp integer will be returned.
  237. * @return mixed Formatted date/time value as string or (integer) unix timestamp (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
  238. * @throws PropelException - if unable to parse/validate the date/time value.
  239. */
  240. public function getCreatedAt($format = 'Y-m-d H:i:s')
  241. {
  242. if ($this->created_at === null) {
  243. return null;
  244. }
  245. if ($this->created_at === '0000-00-00 00:00:00') {
  246. // while technically this is not a default value of NULL,
  247. // this seems to be closest in meaning.
  248. return null;
  249. } else {
  250. try {
  251. $dt = new DateTime($this->created_at);
  252. } catch (Exception $x) {
  253. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x);
  254. }
  255. }
  256. if ($format === null) {
  257. // We cast here to maintain BC in API; obviously we will lose data if we're dealing with pre-/post-epoch dates.
  258. return (int) $dt->format('U');
  259. } elseif (strpos($format, '%') !== false) {
  260. return strftime($format, $dt->format('U'));
  261. } else {
  262. return $dt->format($format);
  263. }
  264. }
  265. /**
  266. * Get the [optionally formatted] temporal [updated_at] column value.
  267. *
  268. * This accessor only only work with unix epoch dates. Consider enabling the propel.useDateTimeClass
  269. * option in order to avoid converstions to integers (which are limited in the dates they can express).
  270. *
  271. * @param string $format The date/time format string (either date()-style or strftime()-style).
  272. * If format is NULL, then the raw unix timestamp integer will be returned.
  273. * @return mixed Formatted date/time value as string or (integer) unix timestamp (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
  274. * @throws PropelException - if unable to parse/validate the date/time value.
  275. */
  276. public function getUpdatedAt($format = 'Y-m-d H:i:s')
  277. {
  278. if ($this->updated_at === null) {
  279. return null;
  280. }
  281. if ($this->updated_at === '0000-00-00 00:00:00') {
  282. // while technically this is not a default value of NULL,
  283. // this seems to be closest in meaning.
  284. return null;
  285. } else {
  286. try {
  287. $dt = new DateTime($this->updated_at);
  288. } catch (Exception $x) {
  289. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x);
  290. }
  291. }
  292. if ($format === null) {
  293. // We cast here to maintain BC in API; obviously we will lose data if we're dealing with pre-/post-epoch dates.
  294. return (int) $dt->format('U');
  295. } elseif (strpos($format, '%') !== false) {
  296. return strftime($format, $dt->format('U'));
  297. } else {
  298. return $dt->format($format);
  299. }
  300. }
  301. /**
  302. * Get the [notification_result] column value.
  303. *
  304. * @return string
  305. */
  306. public function getNotificationResult()
  307. {
  308. return $this->notification_result;
  309. }
  310. /**
  311. * Get the [object_type] column value.
  312. *
  313. * @return int
  314. */
  315. public function getObjectType()
  316. {
  317. return $this->object_type;
  318. }
  319. /**
  320. * Get the [scheduler_id] column value.
  321. *
  322. * @return int
  323. */
  324. public function getSchedulerId()
  325. {
  326. return $this->scheduler_id;
  327. }
  328. /**
  329. * Get the [worker_id] column value.
  330. *
  331. * @return int
  332. */
  333. public function getWorkerId()
  334. {
  335. return $this->worker_id;
  336. }
  337. /**
  338. * Get the [batch_index] column value.
  339. *
  340. * @return int
  341. */
  342. public function getBatchIndex()
  343. {
  344. return $this->batch_index;
  345. }
  346. /**
  347. * Get the [optionally formatted] temporal [processor_expiration] column value.
  348. *
  349. * This accessor only only work with unix epoch dates. Consider enabling the propel.useDateTimeClass
  350. * option in order to avoid converstions to integers (which are limited in the dates they can express).
  351. *
  352. * @param string $format The date/time format string (either date()-style or strftime()-style).
  353. * If format is NULL, then the raw unix timestamp integer will be returned.
  354. * @return mixed Formatted date/time value as string or (integer) unix timestamp (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
  355. * @throws PropelException - if unable to parse/validate the date/time value.
  356. */
  357. public function getProcessorExpiration($format = 'Y-m-d H:i:s')
  358. {
  359. if ($this->processor_expiration === null) {
  360. return null;
  361. }
  362. if ($this->processor_expiration === '0000-00-00 00:00:00') {
  363. // while technically this is not a default value of NULL,
  364. // this seems to be closest in meaning.
  365. return null;
  366. } else {
  367. try {
  368. $dt = new DateTime($this->processor_expiration);
  369. } catch (Exception $x) {
  370. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->processor_expiration, true), $x);
  371. }
  372. }
  373. if ($format === null) {
  374. // We cast here to maintain BC in API; obviously we will lose data if we're dealing with pre-/post-epoch dates.
  375. return (int) $dt->format('U');
  376. } elseif (strpos($format, '%') !== false) {
  377. return strftime($format, $dt->format('U'));
  378. } else {
  379. return $dt->format($format);
  380. }
  381. }
  382. /**
  383. * Get the [execution_attempts] column value.
  384. *
  385. * @return int
  386. */
  387. public function getExecutionAttempts()
  388. {
  389. return $this->execution_attempts;
  390. }
  391. /**
  392. * Get the [lock_version] column value.
  393. *
  394. * @return int
  395. */
  396. public function getLockVersion()
  397. {
  398. return $this->lock_version;
  399. }
  400. /**
  401. * Get the [dc] column value.
  402. *
  403. * @return string
  404. */
  405. public function getDc()
  406. {
  407. return $this->dc;
  408. }
  409. /**
  410. * Set the value of [id] column.
  411. *
  412. * @param int $v new value
  413. * @return notification The current object (for fluent API support)
  414. */
  415. public function setId($v)
  416. {
  417. if(!isset($this->oldColumnsValues[notificationPeer::ID]))
  418. $this->oldColumnsValues[notificationPeer::ID] = $this->id;
  419. if ($v !== null) {
  420. $v = (int) $v;
  421. }
  422. if ($this->id !== $v) {
  423. $this->id = $v;
  424. $this->modifiedColumns[] = notificationPeer::ID;
  425. }
  426. return $this;
  427. } // setId()
  428. /**
  429. * Set the value of [partner_id] column.
  430. *
  431. * @param int $v new value
  432. * @return notification The current object (for fluent API support)
  433. */
  434. public function setPartnerId($v)
  435. {
  436. if(!isset($this->oldColumnsValues[notificationPeer::PARTNER_ID]))
  437. $this->oldColumnsValues[notificationPeer::PARTNER_ID] = $this->partner_id;
  438. if ($v !== null) {
  439. $v = (int) $v;
  440. }
  441. if ($this->partner_id !== $v) {
  442. $this->partner_id = $v;
  443. $this->modifiedColumns[] = notificationPeer::PARTNER_ID;
  444. }
  445. return $this;
  446. } // setPartnerId()
  447. /**
  448. * Set the value of [puser_id] column.
  449. *
  450. * @param string $v new value
  451. * @return notification The current object (for fluent API support)
  452. */
  453. public function setPuserId($v)
  454. {
  455. if(!isset($this->oldColumnsValues[notificationPeer::PUSER_ID]))
  456. $this->oldColumnsValues[notificationPeer::PUSER_ID] = $this->puser_id;
  457. if ($v !== null) {
  458. $v = (string) $v;
  459. }
  460. if ($this->puser_id !== $v) {
  461. $this->puser_id = $v;
  462. $this->modifiedColumns[] = notificationPeer::PUSER_ID;
  463. }
  464. return $this;
  465. } // setPuserId()
  466. /**
  467. * Set the value of [type] column.
  468. *
  469. * @param int $v new value
  470. * @return notification The current object (for fluent API support)
  471. */
  472. public function setType($v)
  473. {
  474. if(!isset($this->oldColumnsValues[notificationPeer::TYPE]))
  475. $this->oldColumnsValues[notificationPeer::TYPE] = $this->type;
  476. if ($v !== null) {
  477. $v = (int) $v;
  478. }
  479. if ($this->type !== $v) {
  480. $this->type = $v;
  481. $this->modifiedColumns[] = notificationPeer::TYPE;
  482. }
  483. return $this;
  484. } // setType()
  485. /**
  486. * Set the value of [object_id] column.
  487. *
  488. * @param string $v new value
  489. * @return notification The current object (for fluent API support)
  490. */
  491. public function setObjectId($v)
  492. {
  493. if(!isset($this->oldColumnsValues[notificationPeer::OBJECT_ID]))
  494. $this->oldColumnsValues[notificationPeer::OBJECT_ID] = $this->object_id;
  495. if ($v !== null) {
  496. $v = (string) $v;
  497. }
  498. if ($this->object_id !== $v) {
  499. $this->object_id = $v;
  500. $this->modifiedColumns[] = notificationPeer::OBJECT_ID;
  501. }
  502. return $this;
  503. } // setObjectId()
  504. /**
  505. * Set the value of [status] column.
  506. *
  507. * @param int $v new value
  508. * @return notification The current object (for fluent API support)
  509. */
  510. public function setStatus($v)
  511. {
  512. if(!isset($this->oldColumnsValues[notificationPeer::STATUS]))
  513. $this->oldColumnsValues[notificationPeer::STATUS] = $this->status;
  514. if ($v !== null) {
  515. $v = (int) $v;
  516. }
  517. if ($this->status !== $v) {
  518. $this->status = $v;
  519. $this->modifiedColumns[] = notificationPeer::STATUS;
  520. }
  521. return $this;
  522. } // setStatus()
  523. /**
  524. * Set the value of [notification_data] column.
  525. *
  526. * @param string $v new value
  527. * @return notification The current object (for fluent API support)
  528. */
  529. public function setNotificationData($v)
  530. {
  531. if(!isset($this->oldColumnsValues[notificationPeer::NOTIFICATION_DATA]))
  532. $this->oldColumnsValues[notificationPeer::NOTIFICATION_DATA] = $this->notification_data;
  533. if ($v !== null) {
  534. $v = (string) $v;
  535. }
  536. if ($this->notification_data !== $v) {
  537. $this->notification_data = $v;
  538. $this->modifiedColumns[] = notificationPeer::NOTIFICATION_DATA;
  539. }
  540. return $this;
  541. } // setNotificationData()
  542. /**
  543. * Set the value of [number_of_attempts] column.
  544. *
  545. * @param int $v new value
  546. * @return notification The current object (for fluent API support)
  547. */
  548. public function setNumberOfAttempts($v)
  549. {
  550. if(!isset($this->oldColumnsValues[notificationPeer::NUMBER_OF_ATTEMPTS]))
  551. $this->oldColumnsValues[notificationPeer::NUMBER_OF_ATTEMPTS] = $this->number_of_attempts;
  552. if ($v !== null) {
  553. $v = (int) $v;
  554. }
  555. if ($this->number_of_attempts !== $v || $this->isNew()) {
  556. $this->number_of_attempts = $v;
  557. $this->modifiedColumns[] = notificationPeer::NUMBER_OF_ATTEMPTS;
  558. }
  559. return $this;
  560. } // setNumberOfAttempts()
  561. /**
  562. * Sets the value of [created_at] column to a normalized version of the date/time value specified.
  563. *
  564. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  565. * be treated as NULL for temporal objects.
  566. * @return notification The current object (for fluent API support)
  567. */
  568. public function setCreatedAt($v)
  569. {
  570. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  571. // -- which is unexpected, to say the least.
  572. if ($v === null || $v === '') {
  573. $dt = null;
  574. } elseif ($v instanceof DateTime) {
  575. $dt = $v;
  576. } else {
  577. // some string/numeric value passed; we normalize that so that we can
  578. // validate it.
  579. try {
  580. if (is_numeric($v)) { // if it's a unix timestamp
  581. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  582. // We have to explicitly specify and then change the time zone because of a
  583. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  584. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  585. } else {
  586. $dt = new DateTime($v);
  587. }
  588. } catch (Exception $x) {
  589. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  590. }
  591. }
  592. if ( $this->created_at !== null || $dt !== null ) {
  593. // (nested ifs are a little easier to read in this case)
  594. $currNorm = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
  595. $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null;
  596. if ( ($currNorm !== $newNorm) // normalized values don't match
  597. )
  598. {
  599. $this->created_at = ($dt ? $dt->format('Y-m-d H:i:s') : null);
  600. $this->modifiedColumns[] = notificationPeer::CREATED_AT;
  601. }
  602. } // if either are not null
  603. return $this;
  604. } // setCreatedAt()
  605. /**
  606. * Sets the value of [updated_at] column to a normalized version of the date/time value specified.
  607. *
  608. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  609. * be treated as NULL for temporal objects.
  610. * @return notification The current object (for fluent API support)
  611. */
  612. public function setUpdatedAt($v)
  613. {
  614. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  615. // -- which is unexpected, to say the least.
  616. if ($v === null || $v === '') {
  617. $dt = null;
  618. } elseif ($v instanceof DateTime) {
  619. $dt = $v;
  620. } else {
  621. // some string/numeric value passed; we normalize that so that we can
  622. // validate it.
  623. try {
  624. if (is_numeric($v)) { // if it's a unix timestamp
  625. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  626. // We have to explicitly specify and then change the time zone because of a
  627. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  628. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  629. } else {
  630. $dt = new DateTime($v);
  631. }
  632. } catch (Exception $x) {
  633. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  634. }
  635. }
  636. if ( $this->updated_at !== null || $dt !== null ) {
  637. // (nested ifs are a little easier to read in this case)
  638. $currNorm = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
  639. $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null;
  640. if ( ($currNorm !== $newNorm) // normalized values don't match
  641. )
  642. {
  643. $this->updated_at = ($dt ? $dt->format('Y-m-d H:i:s') : null);
  644. $this->modifiedColumns[] = notificationPeer::UPDATED_AT;
  645. }
  646. } // if either are not null
  647. return $this;
  648. } // setUpdatedAt()
  649. /**
  650. * Set the value of [notification_result] column.
  651. *
  652. * @param string $v new value
  653. * @return notification The current object (for fluent API support)
  654. */
  655. public function setNotificationResult($v)
  656. {
  657. if(!isset($this->oldColumnsValues[notificationPeer::NOTIFICATION_RESULT]))
  658. $this->oldColumnsValues[notificationPeer::NOTIFICATION_RESULT] = $this->notification_result;
  659. if ($v !== null) {
  660. $v = (string) $v;
  661. }
  662. if ($this->notification_result !== $v) {
  663. $this->notification_result = $v;
  664. $this->modifiedColumns[] = notificationPeer::NOTIFICATION_RESULT;
  665. }
  666. return $this;
  667. } // setNotificationResult()
  668. /**
  669. * Set the value of [object_type] column.
  670. *
  671. * @param int $v new value
  672. * @return notification The current object (for fluent API support)
  673. */
  674. public function setObjectType($v)
  675. {
  676. if(!isset($this->oldColumnsValues[notificationPeer::OBJECT_TYPE]))
  677. $this->oldColumnsValues[notificationPeer::OBJECT_TYPE] = $this->object_type;
  678. if ($v !== null) {
  679. $v = (int) $v;
  680. }
  681. if ($this->object_type !== $v) {
  682. $this->object_type = $v;
  683. $this->modifiedColumns[] = notificationPeer::OBJECT_TYPE;
  684. }
  685. return $this;
  686. } // setObjectType()
  687. /**
  688. * Set the value of [scheduler_id] column.
  689. *
  690. * @param int $v new value
  691. * @return notification The current object (for fluent API support)
  692. */
  693. public function setSchedulerId($v)
  694. {
  695. if(!isset($this->oldColumnsValues[notificationPeer::SCHEDULER_ID]))
  696. $this->oldColumnsValues[notificationPeer::SCHEDULER_ID] = $this->scheduler_id;
  697. if ($v !== null) {
  698. $v = (int) $v;
  699. }
  700. if ($this->scheduler_id !== $v) {
  701. $this->scheduler_id = $v;
  702. $this->modifiedColumns[] = notificationPeer::SCHEDULER_ID;
  703. }
  704. return $this;
  705. } // setSchedulerId()
  706. /**
  707. * Set the value of [worker_id] column.
  708. *
  709. * @param int $v new value
  710. * @return notification The current object (for fluent API support)
  711. */
  712. public function setWorkerId($v)
  713. {
  714. if(!isset($this->oldColumnsValues[notificationPeer::WORKER_ID]))
  715. $this->oldColumnsValues[notificationPeer::WORKER_ID] = $this->worker_id;
  716. if ($v !== null) {
  717. $v = (int) $v;
  718. }
  719. if ($this->worker_id !== $v) {
  720. $this->worker_id = $v;
  721. $this->modifiedColumns[] = notificationPeer::WORKER_ID;
  722. }
  723. return $this;
  724. } // setWorkerId()
  725. /**
  726. * Set the value of [batch_index] column.
  727. *
  728. * @param int $v new value
  729. * @return notification The current object (for fluent API support)
  730. */
  731. public function setBatchIndex($v)
  732. {
  733. if(!isset($this->oldColumnsValues[notificationPeer::BATCH_INDEX]))
  734. $this->oldColumnsValues[notificationPeer::BATCH_INDEX] = $this->batch_index;
  735. if ($v !== null) {
  736. $v = (int) $v;
  737. }
  738. if ($this->batch_index !== $v) {
  739. $this->batch_index = $v;
  740. $this->modifiedColumns[] = notificationPeer::BATCH_INDEX;
  741. }
  742. return $this;
  743. } // setBatchIndex()
  744. /**
  745. * Sets the value of [processor_expiration] column to a normalized version of the date/time value specified.
  746. *
  747. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  748. * be treated as NULL for temporal objects.
  749. * @return notification The current object (for fluent API support)
  750. */
  751. public function setProcessorExpiration($v)
  752. {
  753. if(!isset($this->oldColumnsValues[notificationPeer::PROCESSOR_EXPIRATION]))
  754. $this->oldColumnsValues[notificationPeer::PROCESSOR_EXPIRATION] = $this->processor_expiration;
  755. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  756. // -- which is unexpected, to say the least.
  757. if ($v === null || $v === '') {
  758. $dt = null;
  759. } elseif ($v instanceof DateTime) {
  760. $dt = $v;
  761. } else {
  762. // some string/numeric value passed; we normalize that so that we can
  763. // validate it.
  764. try {
  765. if (is_numeric($v)) { // if it's a unix timestamp
  766. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  767. // We have to explicitly specify and then change the time zone because of a
  768. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  769. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  770. } else {
  771. $dt = new DateTime($v);
  772. }
  773. } catch (Exception $x) {
  774. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  775. }
  776. }
  777. if ( $this->processor_expiration !== null || $dt !== null ) {
  778. // (nested ifs are a little easier to read in this case)
  779. $currNorm = ($this->processor_expiration !== null && $tmpDt = new DateTime($this->processor_expiration)) ? $tmpDt->format('Y-m-d H:i:s') : null;
  780. $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null;
  781. if ( ($currNorm !== $newNorm) // normalized values don't match
  782. )
  783. {
  784. $this->processor_expiration = ($dt ? $dt->format('Y-m-d H:i:s') : null);
  785. $this->modifiedColumns[] = notificationPeer::PROCESSOR_EXPIRATION;
  786. }
  787. } // if either are not null
  788. return $this;
  789. } // setProcessorExpiration()
  790. /**
  791. * Set the value of [execution_attempts] column.
  792. *
  793. * @param int $v new value
  794. * @return notification The current object (for fluent API support)
  795. */
  796. public function setExecutionAttempts($v)
  797. {
  798. if(!isset($this->oldColumnsValues[notificationPeer::EXECUTION_ATTEMPTS]))
  799. $this->oldColumnsValues[notificationPeer::EXECUTION_ATTEMPTS] = $this->execution_attempts;
  800. if ($v !== null) {
  801. $v = (int) $v;
  802. }
  803. if ($this->execution_attempts !== $v) {
  804. $this->execution_attempts = $v;
  805. $this->modifiedColumns[] = notificationPeer::EXECUTION_ATTEMPTS;
  806. }
  807. return $this;
  808. } // setExecutionAttempts()
  809. /**
  810. * Set the value of [lock_version] column.
  811. *
  812. * @param int $v new value
  813. * @return notification The current object (for fluent API support)
  814. */
  815. public function setLockVersion($v)
  816. {
  817. if(!isset($this->oldColumnsValues[notificationPeer::LOCK_VERSION]))
  818. $this->oldColumnsValues[notificationPeer::LOCK_VERSION] = $this->lock_version;
  819. if ($v !== null) {
  820. $v = (int) $v;
  821. }
  822. if ($this->lock_version !== $v) {
  823. $this->lock_version = $v;
  824. $this->modifiedColumns[] = notificationPeer::LOCK_VERSION;
  825. }
  826. return $this;
  827. } // setLockVersion()
  828. /**
  829. * Set the value of [dc] column.
  830. *
  831. * @param string $v new value
  832. * @return notification The current object (for fluent API support)
  833. */
  834. public function setDc($v)
  835. {
  836. if(!isset($this->oldColumnsValues[notificationPeer::DC]))
  837. $this->oldColumnsValues[notificationPeer::DC] = $this->dc;
  838. if ($v !== null) {
  839. $v = (string) $v;
  840. }
  841. if ($this->dc !== $v) {
  842. $this->dc = $v;
  843. $this->modifiedColumns[] = notificationPeer::DC;
  844. }
  845. return $this;
  846. } // setDc()
  847. /**
  848. * Indicates whether the columns in this object are only set to default values.
  849. *
  850. * This method can be used in conjunction with isModified() to indicate whether an object is both
  851. * modified _and_ has some values set which are non-default.
  852. *
  853. * @return boolean Whether the columns in this object are only been set with default values.
  854. */
  855. public function hasOnlyDefaultValues()
  856. {
  857. if ($this->number_of_attempts !== 0) {
  858. return false;
  859. }
  860. // otherwise, everything was equal, so return TRUE
  861. return true;
  862. } // hasOnlyDefaultValues()
  863. /**
  864. * Hydrates (populates) the object variables with values from the database resultset.
  865. *
  866. * An offset (0-based "start column") is specified so that objects can be hydrated
  867. * with a subset of the columns in the resultset rows. This is needed, for example,
  868. * for results of JOIN queries where the resultset row includes columns from two or
  869. * more tables.
  870. *
  871. * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
  872. * @param int $startcol 0-based offset column which indicates which restultset column to start with.
  873. * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
  874. * @return int next starting column
  875. * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
  876. */
  877. public function hydrate($row, $startcol = 0, $rehydrate = false)
  878. {
  879. try {
  880. $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
  881. $this->partner_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
  882. $this->puser_id = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
  883. $this->type = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
  884. $this->object_id = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
  885. $this->status = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
  886. $this->notification_data = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
  887. $this->number_of_attempts = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null;
  888. $this->created_at = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
  889. $this->updated_at = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
  890. $this->notification_result = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
  891. $this->object_type = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null;
  892. $this->scheduler_id = ($row[$startcol + 12] !== null) ? (int) $row[$startcol + 12] : null;
  893. $this->worker_id = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null;
  894. $this->batch_index = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null;
  895. $this->processor_expiration = ($row[$startcol + 15] !== null) ? (string) $row[$startcol + 15] : null;
  896. $this->execution_attempts = ($row[$startcol + 16] !== null) ? (int) $row[$startcol + 16] : null;
  897. $this->lock_version = ($row[$startcol + 17] !== null) ? (int) $row[$startcol + 17] : null;
  898. $this->dc = ($row[$startcol + 18] !== null) ? (string) $row[$startcol + 18] : null;
  899. $this->resetModified();
  900. $this->setNew(false);
  901. if ($rehydrate) {
  902. $this->ensureConsistency();
  903. }
  904. // FIXME - using NUM_COLUMNS may be clearer.
  905. return $startcol + 19; // 19 = notificationPeer::NUM_COLUMNS - notificationPeer::NUM_LAZY_LOAD_COLUMNS).
  906. } catch (Exception $e) {
  907. throw new PropelException("Error populating notification object", $e);
  908. }
  909. }
  910. /**
  911. * Checks and repairs the internal consistency of the object.
  912. *
  913. * This method is executed after an already-instantiated object is re-hydrated
  914. * from the database. It exists to check any foreign keys to make sure that
  915. * the objects related to the current object are correct based on foreign key.
  916. *
  917. * You can override this method in the stub class, but you should always invoke
  918. * the base method from the overridden method (i.e. parent::ensureConsistency()),
  919. * in case your model changes.
  920. *
  921. * @throws PropelException
  922. */
  923. public function ensureConsistency()
  924. {
  925. } // ensureConsistency
  926. /**
  927. * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
  928. *
  929. * This will only work if the object has been saved and has a valid primary key set.
  930. *
  931. * @param boolean $deep (optional) Whether to also de-associated any related objects.
  932. * @param PropelPDO $con (optional) The PropelPDO connection to use.
  933. * @return void
  934. * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
  935. */
  936. public function reload($deep = false, PropelPDO $con = null)
  937. {
  938. if ($this->isDeleted()) {
  939. throw new PropelException("Cannot reload a deleted object.");
  940. }
  941. if ($this->isNew()) {
  942. throw new PropelException("Cannot reload an unsaved object.");
  943. }
  944. if ($con === null) {
  945. $con = Propel::getConnection(notificationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  946. }
  947. // We don't need to alter the object instance pool; we're just modifying this instance
  948. // already in the pool.
  949. notificationPeer::setUseCriteriaFilter(false);
  950. $stmt = notificationPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
  951. notificationPeer::setUseCriteriaFilter(true);
  952. $row = $stmt->fetch(PDO::FETCH_NUM);
  953. $stmt->closeCursor();
  954. if (!$row) {
  955. throw new PropelException('Cannot find matching row in the database to reload object values.');
  956. }
  957. $this->hydrate($row, 0, true); // rehydrate
  958. if ($deep) { // also de-associate any related objects?
  959. } // if (deep)
  960. }
  961. /**
  962. * Removes this object from datastore and sets delete attribute.
  963. *
  964. * @param PropelPDO $con
  965. * @return void
  966. * @throws PropelException
  967. * @see BaseObject::setDeleted()
  968. * @see BaseObject::isDeleted()
  969. */
  970. public function delete(PropelPDO $con = null)
  971. {
  972. if ($this->isDeleted()) {
  973. throw new PropelException("This object has already been deleted.");
  974. }
  975. if ($con === null) {
  976. $con = Propel::getConnection(notificationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  977. }
  978. $con->beginTransaction();
  979. try {
  980. $ret = $this->preDelete($con);
  981. if ($ret) {
  982. notificationPeer::doDelete($this, $con);
  983. $this->postDelete($con);
  984. $this->setDeleted(true);
  985. $con->commit();
  986. } else {
  987. $con->commit();
  988. }
  989. } catch (PropelException $e) {
  990. $con->rollBack();
  991. throw $e;
  992. }
  993. }
  994. /**
  995. * Persists this object to the database.
  996. *
  997. * If the object is new, it inserts it; otherwise an update is performed.
  998. * All modified related objects will also be persisted in the doSave()
  999. * method. This method wraps all precipitate database operations in a
  1000. * single transaction.
  1001. *
  1002. * @param PropelPDO $con
  1003. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  1004. * @throws PropelException
  1005. * @see doSave()
  1006. */
  1007. public function save(PropelPDO $con = null)
  1008. {
  1009. if ($this->isDeleted()) {
  1010. throw new PropelException("You cannot save an object that has been deleted.");
  1011. }
  1012. if ($con === null) {
  1013. $con = Propel::getConnection(notificationPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  1014. }
  1015. $con->beginTransaction();
  1016. $isInsert = $this->isNew();
  1017. try {
  1018. $ret = $this->preSave($con);
  1019. if ($isInsert) {
  1020. $ret = $ret && $this->preInsert($con);
  1021. } else {
  1022. $ret = $ret && $this->preUpdate($con);
  1023. }
  1024. if ($ret) {
  1025. $affectedRows = $this->doSave($con);
  1026. if ($isInsert) {
  1027. $this->postInsert($con);
  1028. } else {
  1029. $this->postUpdate($con);
  1030. }
  1031. $this->postSave($con);
  1032. notificationPeer::addInstanceToPool($this);
  1033. } else {
  1034. $affectedRows = 0;
  1035. }
  1036. $con->commit();
  1037. return $affectedRows;
  1038. } catch (PropelException $e) {
  1039. $con->rollBack();
  1040. throw $e;
  1041. }
  1042. }
  1043. /**
  1044. * Performs the work of inserting or updating the row in the database.
  1045. *
  1046. * If the object is new, it inserts it; otherwise an update is performed.
  1047. * All related objects are also updated in this method.
  1048. *
  1049. * @param PropelPDO $con
  1050. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  1051. * @throws PropelException
  1052. * @see save()
  1053. */
  1054. protected function doSave(PropelPDO $con)
  1055. {
  1056. $affectedRows = 0; // initialize var to track total num of affected rows
  1057. if (!$this->alreadyInSave) {
  1058. $this->alreadyInSave = true;
  1059. if ($this->isNew() ) {
  1060. $this->modifiedColumns[] = notificationPeer::ID;
  1061. }
  1062. // If this object has been modified, then save it to the database.
  1063. if ($this->isModified()) {
  1064. if ($this->isNew()) {
  1065. $pk = notificationPeer::doInsert($this, $con);
  1066. $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
  1067. // should always be true here (even though technically
  1068. // BasePeer::doInsert() can insert multiple rows).
  1069. $this->setId($pk); //[IMV] update autoincrement primary key
  1070. $this->setNew(false);
  1071. } else {
  1072. $affectedRows += notificationPeer::doUpdate($this, $con);
  1073. }
  1074. $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
  1075. }
  1076. $this->alreadyInSave = false;
  1077. }
  1078. return $affectedRows;
  1079. } // doSave()
  1080. /**
  1081. * Override in order to use the query cache.
  1082. * Cache invalidation keys are used to determine when cached queries are valid.
  1083. * Before returning a query result from the cache, the time of the cached query
  1084. * is compared to the time saved in the invalidation key.
  1085. * A cached query will only be used if it's newer than the matching invalidation key.
  1086. *
  1087. * @return array Array of keys that will should be updated when this object is modified.
  1088. */
  1089. public function getCacheInvalidationKeys()
  1090. {
  1091. return array();
  1092. }
  1093. /**
  1094. * Code to be run before persisting the object
  1095. * @param PropelPDO $con
  1096. * @return bloolean
  1097. */
  1098. public function preSave(PropelPDO $con = null)
  1099. {
  1100. return parent::preSave($con);
  1101. }
  1102. /**
  1103. * Code to be run after persisting the object
  1104. * @param PropelPDO $con
  1105. */
  1106. public function postSave(PropelPDO $con = null)
  1107. {
  1108. $this->oldColumnsValues = array();
  1109. }
  1110. /**
  1111. * Code to be run before inserting to database
  1112. * @param PropelPDO $con
  1113. * @return boolean
  1114. */
  1115. public function preInsert(PropelPDO $con = null)
  1116. {
  1117. $this->setCreatedAt(time());
  1118. $this->setUpdatedAt(time());
  1119. return true;
  1120. }
  1121. /**
  1122. * Code to be run after inserting to database
  1123. * @param PropelPDO $con
  1124. */
  1125. public function postInsert(PropelPDO $con = null)
  1126. {
  1127. kQueryCache::invalidateQueryCache($this);
  1128. kEventsManager::raiseEvent(new kObjectCreatedEvent($this));
  1129. if($this->copiedFrom)
  1130. kEventsManager::raiseEvent(new kObjectCopiedEvent($this->copiedFrom, $this));
  1131. }
  1132. /**
  1133. * Code to be run after updating the object in database
  1134. * @param PropelPDO $con
  1135. */
  1136. public function postUpdate(PropelPDO $con = null)
  1137. {
  1138. if ($this->alreadyInSave)
  1139. {
  1140. return;
  1141. }
  1142. if($this->isModified())
  1143. {
  1144. kQueryCache::invalidateQueryCache($this);
  1145. kEventsManager::raiseEvent(new kObjectChangedEvent($this, $this->tempModifiedColumns));
  1146. }
  1147. $this->tempModifiedColumns = array();
  1148. }
  1149. /**
  1150. * Saves the modified columns temporarily while saving
  1151. * @var array
  1152. */
  1153. private $tempModifiedColumns = array();
  1154. /**
  1155. * Returns whether the object has been modified.
  1156. *
  1157. * @return boolean True if the object has been modified.
  1158. */
  1159. public function isModified()
  1160. {
  1161. if(!empty($this->tempModifiedColumns))
  1162. return true;
  1163. return !empty($this->modifiedColumns);
  1164. }
  1165. /**
  1166. * Has specified column been modified?
  1167. *
  1168. * @param string $col
  1169. * @return boolean True if $col has been modified.
  1170. */
  1171. public function isColumnModified($col)
  1172. {
  1173. if(in_array($col, $this->tempModifiedColumns))
  1174. return true;
  1175. return in_array($col, $this->modifiedColumns);
  1176. }
  1177. /**
  1178. * Code to be run before updating the object in database
  1179. * @param PropelPDO $con
  1180. * @return boolean
  1181. */
  1182. public function preUpdate(PropelPDO $con = null)
  1183. {
  1184. if ($this->alreadyInSave)
  1185. {
  1186. return true;
  1187. }
  1188. if($this->isModified())
  1189. $this->setUpdatedAt(time());
  1190. $this->tempModifiedColumns = $this->modifiedColumns;
  1191. return true;
  1192. }
  1193. /**
  1194. * Array of ValidationFailed objects.
  1195. * @var array ValidationFailed[]
  1196. */
  1197. protected $validationFailures = array();
  1198. /**
  1199. * Gets any ValidationFailed objects that resulted from last call to validate().
  1200. *
  1201. *
  1202. * @return array ValidationFailed[]
  1203. * @see validate()
  1204. */
  1205. public function getValidationFailures()
  1206. {
  1207. return $this->validationFailures;
  1208. }
  1209. /**
  1210. * Validates the objects modified field values and all objects related to this table.
  1211. *
  1212. * If $columns is either a column name or an array of column names
  1213. * only those columns are validated.
  1214. *
  1215. * @param mixed $columns Column name or an array of column names.
  1216. * @return boolean Whether all columns pass validation.
  1217. * @see doValidate()
  1218. * @see getValidationFailures()
  1219. */
  1220. public function validate($columns = null)
  1221. {
  1222. $res = $this->doValidate($columns);
  1223. if ($res === true) {
  1224. $this->validationFailures = array();
  1225. return true;
  1226. } else {
  1227. $this->validationFailures = $res;
  1228. return false;
  1229. }
  1230. }
  1231. /**
  1232. * This function performs the validation work for complex object models.
  1233. *
  1234. * In addition to checking the current object, all related objects will
  1235. * also be validated. If all pass then <code>true</code> is returned; otherwise
  1236. * an aggreagated array of ValidationFailed objects will be returned.
  1237. *
  1238. * @param array $columns Array of column names to validate.
  1239. * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  1240. */
  1241. protected function doValidate($columns = null)
  1242. {
  1243. if (!$this->alreadyInValidation) {
  1244. $this->alreadyInValidation = true;
  1245. $retval = null;
  1246. $failureMap = array();
  1247. if (($retval = notificationPeer::doValidate($this, $columns)) !== true) {
  1248. $failureMap = array_merge($failureMap, $retval);
  1249. }
  1250. $this->alreadyInValidation = false;
  1251. }
  1252. return (!empty($failureMap) ? $failureMap : true);
  1253. }
  1254. /**
  1255. * Retrieves a field from the object by name passed in as a string.
  1256. *
  1257. * @param string $name name
  1258. * @param string $type The type of fieldname the $name is of:
  1259. * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  1260. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  1261. * @return mixed Value of field.
  1262. */
  1263. public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
  1264. {
  1265. $pos = notificationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  1266. $field = $this->getByPosition($pos);
  1267. return $field;
  1268. }
  1269. /**
  1270. * Retrieves a field from the object by Position as specified in the xml schema.
  1271. * Zero-based.
  1272. *
  1273. * @param int $pos position in xml schema
  1274. * @return mixed Value of field at $pos
  1275. */
  1276. public function getByPosition($pos)
  1277. {
  1278. switch($pos) {
  1279. case 0:
  1280. return $this->getId();
  1281. break;
  1282. case 1:
  1283. return $this->getPartnerId();
  1284. break;
  1285. case 2:
  1286. return $this->getPuserId();
  1287. break;
  1288. case 3:
  1289. return $this->getType();
  1290. break;
  1291. case 4:
  1292. return $this->getObjectId();
  1293. break;
  1294. case 5:
  1295. return $this->getStatus();
  1296. break;
  1297. case 6:
  1298. return $this->getNotificationData();
  1299. break;
  1300. case 7:
  1301. return $this->getNumberOfAttempts();
  1302. break;
  1303. case 8:
  1304. return $this->getCreatedAt();
  1305. break;
  1306. case 9:
  1307. return $this->getUpdatedAt();
  1308. break;
  1309. case 10:
  1310. return $this->getNotificationResult();
  1311. break;
  1312. case 11:
  1313. return $this->getObjectType();
  1314. break;
  1315. case 12:
  1316. return $this->getSchedulerId();
  1317. break;
  1318. case 13:
  1319. return $this->getWorkerId();
  1320. break;
  1321. case 14:
  1322. return $this->getBatchIndex();
  1323. break;
  1324. case 15:
  1325. return $this->getProcessorExpiration();
  1326. break;
  1327. case 16:
  1328. return $this->getExecutionAttempts();
  1329. break;
  1330. case 17:
  1331. return $this->getLockVersion();
  1332. break;
  1333. case 18:
  1334. return $this->getDc();
  1335. break;
  1336. default:
  1337. return null;
  1338. break;
  1339. } // switch()
  1340. }
  1341. /**
  1342. * Exports the object as an array.
  1343. *
  1344. * You can specify the key type of the array by passing one of the class
  1345. * type constants.
  1346. *
  1347. * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  1348. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME.
  1349. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  1350. * @return an associative array containing the field names (as keys) and field values
  1351. */
  1352. public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
  1353. {
  1354. $keys = notificationPeer::getFieldNames($keyType);
  1355. $result = array(
  1356. $keys[0] => $this->getId(),
  1357. $keys[1] => $this->getPartnerId(),
  1358. $keys[2] => $this->getPuserId(),
  1359. $keys[3] => $this->getType(),
  1360. $keys[4] => $this->getObjectId(),
  1361. $keys[5] => $this->getStatus(),
  1362. $keys[6] => $this->getNotificationData(),
  1363. $keys[7] => $this->getNumberOfAttempts(),
  1364. $keys[8] => $this->getCreatedAt(),
  1365. $keys[9] => $this->getUpdatedAt(),
  1366. $keys[10] => $this->getNotificationResult(),
  1367. $keys[11] => $this->getObjectType(),
  1368. $keys[12] => $this->getSchedulerId(),
  1369. $keys[13] => $this->getWorkerId(),
  1370. $keys[14] => $this->getBatchIndex(),
  1371. $keys[15] => $this->getProcessorExpiration(),
  1372. $keys[16] => $this->getExecutionAttempts(),
  1373. $keys[17] => $this->getLockVersion(),
  1374. $keys[18] => $this->getDc(),
  1375. );
  1376. return $result;
  1377. }
  1378. /**
  1379. * Sets a field from the object by name passed in as a string.
  1380. *
  1381. * @param string $name peer name
  1382. * @param mixed $value field value
  1383. * @param string $type The type of fieldname the $name is of:
  1384. * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  1385. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  1386. * @return void
  1387. */
  1388. public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
  1389. {
  1390. $pos = notificationPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  1391. return $this->setByPosition($pos, $value);
  1392. }
  1393. /**
  1394. * Sets a field from the object by Position as specified in the xml schema.
  1395. * Zero-based.
  1396. *
  1397. * @param int $pos position in xml schema
  1398. * @param mixed $value field value
  1399. * @return void
  1400. */
  1401. public function setByPosition($pos, $value)
  1402. {
  1403. switch($pos) {
  1404. case 0:
  1405. $this->setId($value);
  1406. break;
  1407. case 1:
  1408. $this->setPartnerId($value);
  1409. break;
  1410. case 2:
  1411. $this->setPuserId($value);
  1412. break;
  1413. case 3:
  1414. $this->setType($value);
  1415. break;
  1416. case 4:
  1417. $this->setObjectId($value);
  1418. break;
  1419. case 5:
  1420. $this->setStatus($value);
  1421. break;
  1422. case 6:
  1423. $this->setNotificationData($value);
  1424. break;
  1425. case 7:
  1426. $this->setNumberOfAttempts($value);
  1427. break;
  1428. case 8:
  1429. $this->setCreatedAt($value);
  1430. break;
  1431. case 9:
  1432. $this->setUpdatedAt($value);
  1433. break;
  1434. case 10:
  1435. $this->setNotificationResult($value);
  1436. break;
  1437. case 11:
  1438. $this->setObjectType($value);
  1439. break;
  1440. case 12:
  1441. $this->setSchedulerId($value);
  1442. break;
  1443. case 13:
  1444. $this->setWorkerId($value);
  1445. break;
  1446. case 14:
  1447. $this->setBatchIndex($value);
  1448. break;
  1449. case 15:
  1450. $this->setProcessorExpiration($value);
  1451. break;
  1452. case 16:
  1453. $this->setExecutionAttempts($value);
  1454. break;
  1455. case 17:
  1456. $this->setLockVersion($value);
  1457. break;
  1458. case 18:
  1459. $this->setDc($value);
  1460. break;
  1461. } // switch()
  1462. }
  1463. /**
  1464. * Populates the object using an array.
  1465. *
  1466. * This is particularly useful when populating an object from one of the
  1467. * request arrays (e.g. $_POST). This method goes through the column
  1468. * names, checking to see whether a matching key exists in populated
  1469. * array. If so the setByName() method is called for that column.
  1470. *
  1471. * You can specify the key type of the array by additionally passing one
  1472. * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  1473. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  1474. * The default key type is the column's phpname (e.g. 'AuthorId')
  1475. *
  1476. * @param array $arr An array to populate the object from.
  1477. * @param string $keyType The type of keys the array uses.
  1478. * @return void
  1479. */
  1480. public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
  1481. {
  1482. $keys = notificationPeer::getFieldNames($keyType);
  1483. if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
  1484. if (array_key_exists($keys[1], $arr)) $this->setPartnerId($arr[$keys[1]]);
  1485. if (array_key_exists($keys[2], $arr)) $this->setPuserId($arr[$keys[2]]);
  1486. if (array_key_exists($keys[3], $arr)) $this->setType($arr[$keys[3]]);
  1487. if (array_key_exists($keys[4], $arr)) $this->setObjectId($arr[$keys[4]]);
  1488. if (array_key_exists($keys[5], $arr)) $this->setStatus($arr[$keys[5]]);
  1489. if (array_key_exists($keys[6], $arr)) $this->setNotificationData($arr[$keys[6]]);
  1490. if (array_key_exists($keys[7], $arr)) $this->setNumberOfAttempts($arr[$keys[7]]);
  1491. if (array_key_exists($keys[8], $arr)) $this->setCreatedAt($arr[$keys[8]]);
  1492. if (array_key_exists($keys[9], $arr)) $this->setUpdatedAt($arr[$keys[9]]);
  1493. if (array_key_exists($keys[10], $arr)) $this->setNotificationResult($arr[$keys[10]]);
  1494. if (array_key_exists($keys[11], $arr)) $this->setObjectType($arr[$keys[11]]);
  1495. if (array_key_exists($keys[12], $arr)) $this->setSchedulerId($arr[$keys[12]]);
  1496. if (array_key_exists($keys[13], $arr)) $this->setWorkerId($arr[$keys[13]]);
  1497. if (array_key_exists($keys[14], $arr)) $this->setBatchIndex($arr[$keys[14]]);
  1498. if (array_key_exists($keys[15], $arr)) $this->setProcessorExpiration($arr[$keys[15]]);
  1499. if (array_key_exists($keys[16], $arr)) $this->setExecutionAttempts($arr[$keys[16]]);
  1500. if (array_key_exists($keys[17], $arr)) $this->setLockVersion($arr[$keys[17]]);
  1501. if (array_key_exists($keys[18], $arr)) $this->setDc($arr[$keys[18]]);
  1502. }
  1503. /**
  1504. * Build a Criteria object containing the values of all modified columns in this object.
  1505. *
  1506. * @return Criteria The Criteria object containing all modified values.
  1507. */
  1508. public function buildCriteria()
  1509. {
  1510. $criteria = new Criteria(notificationPeer::DATABASE_NAME);
  1511. if ($this->isColumnModified(notificationPeer::ID)) $criteria->add(notificationPeer::ID, $this->id);
  1512. if ($this->isColumnModified(notificationPeer::PARTNER_ID)) $criteria->add(notificationPeer::PARTNER_ID, $this->partner_id);
  1513. if ($this->isColumnModified(notificationPeer::PUSER_ID)) $criteria->add(notificationPeer::PUSER_ID, $this->puser_id);
  1514. if ($this->isColumnModified(notificationPeer::TYPE)) $criteria->add(notificationPeer::TYPE, $this->type);
  1515. if ($this->isColumnModified(notificationPeer::OBJECT_ID)) $criteria->add(notificationPeer::OBJECT_ID, $this->object_id);
  1516. if ($this->isColumnModified(notificationPeer::STATUS)) $criteria->add(notificationPeer::STATUS, $this->status);
  1517. if ($this->isColumnModified(notificationPeer::NOTIFICATION_DATA)) $criteria->add(notificationPeer::NOTIFICATION_DATA, $this->notification_data);
  1518. if ($this->isColumnModified(notificationPeer::NUMBER_OF_ATTEMPTS)) $criteria->add(notificationPeer::NUMBER_OF_ATTEMPTS, $this->number_of_attempts);
  1519. if ($this->isColumnModified(notificationPeer::CREATED_AT)) $criteria->add(notificationPeer::CREATED_AT, $this->created_at);
  1520. if ($this->isColumnModified(notificationPeer::UPDATED_AT)) $criteria->add(notificationPeer::UPDATED_AT, $this->updated_at);
  1521. if ($this->isColumnModified(notificationPeer::NOTIFICATION_RESULT)) $criteria->add(notificationPeer::NOTIFICATION_RESULT, $this->notification_result);
  1522. if ($this->isColumnModified(notificationPeer::OBJECT_TYPE)) $criteria->add(notificationPeer::OBJECT_TYPE, $this->object_type);
  1523. if ($this->isColumnModified(notificationPeer::SCHEDULER_ID)) $criteria->add(notificationPeer::SCHEDULER_ID, $this->scheduler_id);
  1524. if ($this->isColumnModified(notificationPeer::WORKER_ID)) $criteria->add(notificationPeer::WORKER_ID, $this->worker_id);
  1525. if ($this->isColumnModified(notificationPeer::BATCH_INDEX)) $criteria->add(notificationPeer::BATCH_INDEX, $this->batch_index);
  1526. if ($this->isColumnModified(notificationPeer::PROCESSOR_EXPIRATION)) $criteria->add(notificationPeer::PROCESSOR_EXPIRATIO

Large files files are truncated, but you can click here to view the full file