PageRenderTime 59ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

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

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