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

https://bitbucket.org/pandaos/kaltura · PHP · 1708 lines · 871 code · 218 blank · 619 comment · 144 complexity · 48501e006b97e671d9ae4dee26eb17f8 MD5 · raw file

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