PageRenderTime 47ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/pandaos/kaltura
PHP | 1246 lines | 597 code | 164 blank | 485 comment | 87 complexity | e0447302c6dc491f168486cc63acb046 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 'kce_installation_error' table.
  4. *
  5. *
  6. *
  7. * @package Core
  8. * @subpackage model.om
  9. */
  10. abstract class BaseKceInstallationError 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 KceInstallationErrorPeer
  16. */
  17. protected static $peer;
  18. /**
  19. * The value for the id field.
  20. * @var int
  21. */
  22. protected $id;
  23. /**
  24. * The value for the partner_id field.
  25. * @var int
  26. */
  27. protected $partner_id;
  28. /**
  29. * The value for the browser field.
  30. * @var string
  31. */
  32. protected $browser;
  33. /**
  34. * The value for the server_ip field.
  35. * @var string
  36. */
  37. protected $server_ip;
  38. /**
  39. * The value for the server_os field.
  40. * @var string
  41. */
  42. protected $server_os;
  43. /**
  44. * The value for the php_version field.
  45. * @var string
  46. */
  47. protected $php_version;
  48. /**
  49. * The value for the ce_admin_email field.
  50. * @var string
  51. */
  52. protected $ce_admin_email;
  53. /**
  54. * The value for the type field.
  55. * @var string
  56. */
  57. protected $type;
  58. /**
  59. * The value for the description field.
  60. * @var string
  61. */
  62. protected $description;
  63. /**
  64. * The value for the data field.
  65. * @var string
  66. */
  67. protected $data;
  68. /**
  69. * Flag to prevent endless save loop, if this object is referenced
  70. * by another object which falls in this transaction.
  71. * @var boolean
  72. */
  73. protected $alreadyInSave = false;
  74. /**
  75. * Flag to prevent endless validation loop, if this object is referenced
  76. * by another object which falls in this transaction.
  77. * @var boolean
  78. */
  79. protected $alreadyInValidation = false;
  80. /**
  81. * Store columns old values before the changes
  82. * @var array
  83. */
  84. protected $oldColumnsValues = array();
  85. /**
  86. * @return array
  87. */
  88. public function getColumnsOldValues()
  89. {
  90. return $this->oldColumnsValues;
  91. }
  92. /**
  93. * Get the [id] column value.
  94. *
  95. * @return int
  96. */
  97. public function getId()
  98. {
  99. return $this->id;
  100. }
  101. /**
  102. * Get the [partner_id] column value.
  103. *
  104. * @return int
  105. */
  106. public function getPartnerId()
  107. {
  108. return $this->partner_id;
  109. }
  110. /**
  111. * Get the [browser] column value.
  112. *
  113. * @return string
  114. */
  115. public function getBrowser()
  116. {
  117. return $this->browser;
  118. }
  119. /**
  120. * Get the [server_ip] column value.
  121. *
  122. * @return string
  123. */
  124. public function getServerIp()
  125. {
  126. return $this->server_ip;
  127. }
  128. /**
  129. * Get the [server_os] column value.
  130. *
  131. * @return string
  132. */
  133. public function getServerOs()
  134. {
  135. return $this->server_os;
  136. }
  137. /**
  138. * Get the [php_version] column value.
  139. *
  140. * @return string
  141. */
  142. public function getPhpVersion()
  143. {
  144. return $this->php_version;
  145. }
  146. /**
  147. * Get the [ce_admin_email] column value.
  148. *
  149. * @return string
  150. */
  151. public function getCeAdminEmail()
  152. {
  153. return $this->ce_admin_email;
  154. }
  155. /**
  156. * Get the [type] column value.
  157. *
  158. * @return string
  159. */
  160. public function getType()
  161. {
  162. return $this->type;
  163. }
  164. /**
  165. * Get the [description] column value.
  166. *
  167. * @return string
  168. */
  169. public function getDescription()
  170. {
  171. return $this->description;
  172. }
  173. /**
  174. * Get the [data] column value.
  175. *
  176. * @return string
  177. */
  178. public function getData()
  179. {
  180. return $this->data;
  181. }
  182. /**
  183. * Set the value of [id] column.
  184. *
  185. * @param int $v new value
  186. * @return KceInstallationError The current object (for fluent API support)
  187. */
  188. public function setId($v)
  189. {
  190. if(!isset($this->oldColumnsValues[KceInstallationErrorPeer::ID]))
  191. $this->oldColumnsValues[KceInstallationErrorPeer::ID] = $this->id;
  192. if ($v !== null) {
  193. $v = (int) $v;
  194. }
  195. if ($this->id !== $v) {
  196. $this->id = $v;
  197. $this->modifiedColumns[] = KceInstallationErrorPeer::ID;
  198. }
  199. return $this;
  200. } // setId()
  201. /**
  202. * Set the value of [partner_id] column.
  203. *
  204. * @param int $v new value
  205. * @return KceInstallationError The current object (for fluent API support)
  206. */
  207. public function setPartnerId($v)
  208. {
  209. if(!isset($this->oldColumnsValues[KceInstallationErrorPeer::PARTNER_ID]))
  210. $this->oldColumnsValues[KceInstallationErrorPeer::PARTNER_ID] = $this->partner_id;
  211. if ($v !== null) {
  212. $v = (int) $v;
  213. }
  214. if ($this->partner_id !== $v) {
  215. $this->partner_id = $v;
  216. $this->modifiedColumns[] = KceInstallationErrorPeer::PARTNER_ID;
  217. }
  218. return $this;
  219. } // setPartnerId()
  220. /**
  221. * Set the value of [browser] column.
  222. *
  223. * @param string $v new value
  224. * @return KceInstallationError The current object (for fluent API support)
  225. */
  226. public function setBrowser($v)
  227. {
  228. if(!isset($this->oldColumnsValues[KceInstallationErrorPeer::BROWSER]))
  229. $this->oldColumnsValues[KceInstallationErrorPeer::BROWSER] = $this->browser;
  230. if ($v !== null) {
  231. $v = (string) $v;
  232. }
  233. if ($this->browser !== $v) {
  234. $this->browser = $v;
  235. $this->modifiedColumns[] = KceInstallationErrorPeer::BROWSER;
  236. }
  237. return $this;
  238. } // setBrowser()
  239. /**
  240. * Set the value of [server_ip] column.
  241. *
  242. * @param string $v new value
  243. * @return KceInstallationError The current object (for fluent API support)
  244. */
  245. public function setServerIp($v)
  246. {
  247. if(!isset($this->oldColumnsValues[KceInstallationErrorPeer::SERVER_IP]))
  248. $this->oldColumnsValues[KceInstallationErrorPeer::SERVER_IP] = $this->server_ip;
  249. if ($v !== null) {
  250. $v = (string) $v;
  251. }
  252. if ($this->server_ip !== $v) {
  253. $this->server_ip = $v;
  254. $this->modifiedColumns[] = KceInstallationErrorPeer::SERVER_IP;
  255. }
  256. return $this;
  257. } // setServerIp()
  258. /**
  259. * Set the value of [server_os] column.
  260. *
  261. * @param string $v new value
  262. * @return KceInstallationError The current object (for fluent API support)
  263. */
  264. public function setServerOs($v)
  265. {
  266. if(!isset($this->oldColumnsValues[KceInstallationErrorPeer::SERVER_OS]))
  267. $this->oldColumnsValues[KceInstallationErrorPeer::SERVER_OS] = $this->server_os;
  268. if ($v !== null) {
  269. $v = (string) $v;
  270. }
  271. if ($this->server_os !== $v) {
  272. $this->server_os = $v;
  273. $this->modifiedColumns[] = KceInstallationErrorPeer::SERVER_OS;
  274. }
  275. return $this;
  276. } // setServerOs()
  277. /**
  278. * Set the value of [php_version] column.
  279. *
  280. * @param string $v new value
  281. * @return KceInstallationError The current object (for fluent API support)
  282. */
  283. public function setPhpVersion($v)
  284. {
  285. if(!isset($this->oldColumnsValues[KceInstallationErrorPeer::PHP_VERSION]))
  286. $this->oldColumnsValues[KceInstallationErrorPeer::PHP_VERSION] = $this->php_version;
  287. if ($v !== null) {
  288. $v = (string) $v;
  289. }
  290. if ($this->php_version !== $v) {
  291. $this->php_version = $v;
  292. $this->modifiedColumns[] = KceInstallationErrorPeer::PHP_VERSION;
  293. }
  294. return $this;
  295. } // setPhpVersion()
  296. /**
  297. * Set the value of [ce_admin_email] column.
  298. *
  299. * @param string $v new value
  300. * @return KceInstallationError The current object (for fluent API support)
  301. */
  302. public function setCeAdminEmail($v)
  303. {
  304. if(!isset($this->oldColumnsValues[KceInstallationErrorPeer::CE_ADMIN_EMAIL]))
  305. $this->oldColumnsValues[KceInstallationErrorPeer::CE_ADMIN_EMAIL] = $this->ce_admin_email;
  306. if ($v !== null) {
  307. $v = (string) $v;
  308. }
  309. if ($this->ce_admin_email !== $v) {
  310. $this->ce_admin_email = $v;
  311. $this->modifiedColumns[] = KceInstallationErrorPeer::CE_ADMIN_EMAIL;
  312. }
  313. return $this;
  314. } // setCeAdminEmail()
  315. /**
  316. * Set the value of [type] column.
  317. *
  318. * @param string $v new value
  319. * @return KceInstallationError The current object (for fluent API support)
  320. */
  321. public function setType($v)
  322. {
  323. if(!isset($this->oldColumnsValues[KceInstallationErrorPeer::TYPE]))
  324. $this->oldColumnsValues[KceInstallationErrorPeer::TYPE] = $this->type;
  325. if ($v !== null) {
  326. $v = (string) $v;
  327. }
  328. if ($this->type !== $v) {
  329. $this->type = $v;
  330. $this->modifiedColumns[] = KceInstallationErrorPeer::TYPE;
  331. }
  332. return $this;
  333. } // setType()
  334. /**
  335. * Set the value of [description] column.
  336. *
  337. * @param string $v new value
  338. * @return KceInstallationError The current object (for fluent API support)
  339. */
  340. public function setDescription($v)
  341. {
  342. if(!isset($this->oldColumnsValues[KceInstallationErrorPeer::DESCRIPTION]))
  343. $this->oldColumnsValues[KceInstallationErrorPeer::DESCRIPTION] = $this->description;
  344. if ($v !== null) {
  345. $v = (string) $v;
  346. }
  347. if ($this->description !== $v) {
  348. $this->description = $v;
  349. $this->modifiedColumns[] = KceInstallationErrorPeer::DESCRIPTION;
  350. }
  351. return $this;
  352. } // setDescription()
  353. /**
  354. * Set the value of [data] column.
  355. *
  356. * @param string $v new value
  357. * @return KceInstallationError The current object (for fluent API support)
  358. */
  359. public function setData($v)
  360. {
  361. if(!isset($this->oldColumnsValues[KceInstallationErrorPeer::DATA]))
  362. $this->oldColumnsValues[KceInstallationErrorPeer::DATA] = $this->data;
  363. if ($v !== null) {
  364. $v = (string) $v;
  365. }
  366. if ($this->data !== $v) {
  367. $this->data = $v;
  368. $this->modifiedColumns[] = KceInstallationErrorPeer::DATA;
  369. }
  370. return $this;
  371. } // setData()
  372. /**
  373. * Indicates whether the columns in this object are only set to default values.
  374. *
  375. * This method can be used in conjunction with isModified() to indicate whether an object is both
  376. * modified _and_ has some values set which are non-default.
  377. *
  378. * @return boolean Whether the columns in this object are only been set with default values.
  379. */
  380. public function hasOnlyDefaultValues()
  381. {
  382. // otherwise, everything was equal, so return TRUE
  383. return true;
  384. } // hasOnlyDefaultValues()
  385. /**
  386. * Hydrates (populates) the object variables with values from the database resultset.
  387. *
  388. * An offset (0-based "start column") is specified so that objects can be hydrated
  389. * with a subset of the columns in the resultset rows. This is needed, for example,
  390. * for results of JOIN queries where the resultset row includes columns from two or
  391. * more tables.
  392. *
  393. * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
  394. * @param int $startcol 0-based offset column which indicates which restultset column to start with.
  395. * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
  396. * @return int next starting column
  397. * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
  398. */
  399. public function hydrate($row, $startcol = 0, $rehydrate = false)
  400. {
  401. try {
  402. $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
  403. $this->partner_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
  404. $this->browser = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
  405. $this->server_ip = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
  406. $this->server_os = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
  407. $this->php_version = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
  408. $this->ce_admin_email = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
  409. $this->type = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
  410. $this->description = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
  411. $this->data = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
  412. $this->resetModified();
  413. $this->setNew(false);
  414. if ($rehydrate) {
  415. $this->ensureConsistency();
  416. }
  417. // FIXME - using NUM_COLUMNS may be clearer.
  418. return $startcol + 10; // 10 = KceInstallationErrorPeer::NUM_COLUMNS - KceInstallationErrorPeer::NUM_LAZY_LOAD_COLUMNS).
  419. } catch (Exception $e) {
  420. throw new PropelException("Error populating KceInstallationError object", $e);
  421. }
  422. }
  423. /**
  424. * Checks and repairs the internal consistency of the object.
  425. *
  426. * This method is executed after an already-instantiated object is re-hydrated
  427. * from the database. It exists to check any foreign keys to make sure that
  428. * the objects related to the current object are correct based on foreign key.
  429. *
  430. * You can override this method in the stub class, but you should always invoke
  431. * the base method from the overridden method (i.e. parent::ensureConsistency()),
  432. * in case your model changes.
  433. *
  434. * @throws PropelException
  435. */
  436. public function ensureConsistency()
  437. {
  438. } // ensureConsistency
  439. /**
  440. * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
  441. *
  442. * This will only work if the object has been saved and has a valid primary key set.
  443. *
  444. * @param boolean $deep (optional) Whether to also de-associated any related objects.
  445. * @param PropelPDO $con (optional) The PropelPDO connection to use.
  446. * @return void
  447. * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
  448. */
  449. public function reload($deep = false, PropelPDO $con = null)
  450. {
  451. if ($this->isDeleted()) {
  452. throw new PropelException("Cannot reload a deleted object.");
  453. }
  454. if ($this->isNew()) {
  455. throw new PropelException("Cannot reload an unsaved object.");
  456. }
  457. if ($con === null) {
  458. $con = Propel::getConnection(KceInstallationErrorPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  459. }
  460. // We don't need to alter the object instance pool; we're just modifying this instance
  461. // already in the pool.
  462. KceInstallationErrorPeer::setUseCriteriaFilter(false);
  463. $stmt = KceInstallationErrorPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
  464. KceInstallationErrorPeer::setUseCriteriaFilter(true);
  465. $row = $stmt->fetch(PDO::FETCH_NUM);
  466. $stmt->closeCursor();
  467. if (!$row) {
  468. throw new PropelException('Cannot find matching row in the database to reload object values.');
  469. }
  470. $this->hydrate($row, 0, true); // rehydrate
  471. if ($deep) { // also de-associate any related objects?
  472. } // if (deep)
  473. }
  474. /**
  475. * Removes this object from datastore and sets delete attribute.
  476. *
  477. * @param PropelPDO $con
  478. * @return void
  479. * @throws PropelException
  480. * @see BaseObject::setDeleted()
  481. * @see BaseObject::isDeleted()
  482. */
  483. public function delete(PropelPDO $con = null)
  484. {
  485. if ($this->isDeleted()) {
  486. throw new PropelException("This object has already been deleted.");
  487. }
  488. if ($con === null) {
  489. $con = Propel::getConnection(KceInstallationErrorPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  490. }
  491. $con->beginTransaction();
  492. try {
  493. $ret = $this->preDelete($con);
  494. if ($ret) {
  495. KceInstallationErrorPeer::doDelete($this, $con);
  496. $this->postDelete($con);
  497. $this->setDeleted(true);
  498. $con->commit();
  499. } else {
  500. $con->commit();
  501. }
  502. } catch (PropelException $e) {
  503. $con->rollBack();
  504. throw $e;
  505. }
  506. }
  507. /**
  508. * Persists this object to the database.
  509. *
  510. * If the object is new, it inserts it; otherwise an update is performed.
  511. * All modified related objects will also be persisted in the doSave()
  512. * method. This method wraps all precipitate database operations in a
  513. * single transaction.
  514. *
  515. * @param PropelPDO $con
  516. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  517. * @throws PropelException
  518. * @see doSave()
  519. */
  520. public function save(PropelPDO $con = null)
  521. {
  522. if ($this->isDeleted()) {
  523. throw new PropelException("You cannot save an object that has been deleted.");
  524. }
  525. if ($con === null) {
  526. $con = Propel::getConnection(KceInstallationErrorPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  527. }
  528. $con->beginTransaction();
  529. $isInsert = $this->isNew();
  530. try {
  531. $ret = $this->preSave($con);
  532. if ($isInsert) {
  533. $ret = $ret && $this->preInsert($con);
  534. } else {
  535. $ret = $ret && $this->preUpdate($con);
  536. }
  537. if ($ret) {
  538. $affectedRows = $this->doSave($con);
  539. if ($isInsert) {
  540. $this->postInsert($con);
  541. } else {
  542. $this->postUpdate($con);
  543. }
  544. $this->postSave($con);
  545. KceInstallationErrorPeer::addInstanceToPool($this);
  546. } else {
  547. $affectedRows = 0;
  548. }
  549. $con->commit();
  550. return $affectedRows;
  551. } catch (PropelException $e) {
  552. $con->rollBack();
  553. throw $e;
  554. }
  555. }
  556. /**
  557. * Performs the work of inserting or updating the row in the database.
  558. *
  559. * If the object is new, it inserts it; otherwise an update is performed.
  560. * All related objects are also updated in this method.
  561. *
  562. * @param PropelPDO $con
  563. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  564. * @throws PropelException
  565. * @see save()
  566. */
  567. protected function doSave(PropelPDO $con)
  568. {
  569. $affectedRows = 0; // initialize var to track total num of affected rows
  570. if (!$this->alreadyInSave) {
  571. $this->alreadyInSave = true;
  572. if ($this->isNew() ) {
  573. $this->modifiedColumns[] = KceInstallationErrorPeer::ID;
  574. }
  575. // If this object has been modified, then save it to the database.
  576. if ($this->isModified()) {
  577. if ($this->isNew()) {
  578. $pk = KceInstallationErrorPeer::doInsert($this, $con);
  579. $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
  580. // should always be true here (even though technically
  581. // BasePeer::doInsert() can insert multiple rows).
  582. $this->setId($pk); //[IMV] update autoincrement primary key
  583. $this->setNew(false);
  584. } else {
  585. $affectedRows += KceInstallationErrorPeer::doUpdate($this, $con);
  586. }
  587. $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
  588. }
  589. $this->alreadyInSave = false;
  590. }
  591. return $affectedRows;
  592. } // doSave()
  593. /**
  594. * Override in order to use the query cache.
  595. * Cache invalidation keys are used to determine when cached queries are valid.
  596. * Before returning a query result from the cache, the time of the cached query
  597. * is compared to the time saved in the invalidation key.
  598. * A cached query will only be used if it's newer than the matching invalidation key.
  599. *
  600. * @return array Array of keys that will should be updated when this object is modified.
  601. */
  602. public function getCacheInvalidationKeys()
  603. {
  604. return array();
  605. }
  606. /**
  607. * Code to be run before persisting the object
  608. * @param PropelPDO $con
  609. * @return bloolean
  610. */
  611. public function preSave(PropelPDO $con = null)
  612. {
  613. return parent::preSave($con);
  614. }
  615. /**
  616. * Code to be run after persisting the object
  617. * @param PropelPDO $con
  618. */
  619. public function postSave(PropelPDO $con = null)
  620. {
  621. $this->oldColumnsValues = array();
  622. }
  623. /**
  624. * Code to be run before inserting to database
  625. * @param PropelPDO $con
  626. * @return boolean
  627. */
  628. public function preInsert(PropelPDO $con = null)
  629. {
  630. return true;
  631. }
  632. /**
  633. * Code to be run after inserting to database
  634. * @param PropelPDO $con
  635. */
  636. public function postInsert(PropelPDO $con = null)
  637. {
  638. kQueryCache::invalidateQueryCache($this);
  639. kEventsManager::raiseEvent(new kObjectCreatedEvent($this));
  640. if($this->copiedFrom)
  641. kEventsManager::raiseEvent(new kObjectCopiedEvent($this->copiedFrom, $this));
  642. }
  643. /**
  644. * Code to be run after updating the object in database
  645. * @param PropelPDO $con
  646. */
  647. public function postUpdate(PropelPDO $con = null)
  648. {
  649. if ($this->alreadyInSave)
  650. {
  651. return;
  652. }
  653. if($this->isModified())
  654. {
  655. kQueryCache::invalidateQueryCache($this);
  656. kEventsManager::raiseEvent(new kObjectChangedEvent($this, $this->tempModifiedColumns));
  657. }
  658. $this->tempModifiedColumns = array();
  659. }
  660. /**
  661. * Saves the modified columns temporarily while saving
  662. * @var array
  663. */
  664. private $tempModifiedColumns = array();
  665. /**
  666. * Returns whether the object has been modified.
  667. *
  668. * @return boolean True if the object has been modified.
  669. */
  670. public function isModified()
  671. {
  672. if(!empty($this->tempModifiedColumns))
  673. return true;
  674. return !empty($this->modifiedColumns);
  675. }
  676. /**
  677. * Has specified column been modified?
  678. *
  679. * @param string $col
  680. * @return boolean True if $col has been modified.
  681. */
  682. public function isColumnModified($col)
  683. {
  684. if(in_array($col, $this->tempModifiedColumns))
  685. return true;
  686. return in_array($col, $this->modifiedColumns);
  687. }
  688. /**
  689. * Code to be run before updating the object in database
  690. * @param PropelPDO $con
  691. * @return boolean
  692. */
  693. public function preUpdate(PropelPDO $con = null)
  694. {
  695. if ($this->alreadyInSave)
  696. {
  697. return true;
  698. }
  699. $this->tempModifiedColumns = $this->modifiedColumns;
  700. return true;
  701. }
  702. /**
  703. * Array of ValidationFailed objects.
  704. * @var array ValidationFailed[]
  705. */
  706. protected $validationFailures = array();
  707. /**
  708. * Gets any ValidationFailed objects that resulted from last call to validate().
  709. *
  710. *
  711. * @return array ValidationFailed[]
  712. * @see validate()
  713. */
  714. public function getValidationFailures()
  715. {
  716. return $this->validationFailures;
  717. }
  718. /**
  719. * Validates the objects modified field values and all objects related to this table.
  720. *
  721. * If $columns is either a column name or an array of column names
  722. * only those columns are validated.
  723. *
  724. * @param mixed $columns Column name or an array of column names.
  725. * @return boolean Whether all columns pass validation.
  726. * @see doValidate()
  727. * @see getValidationFailures()
  728. */
  729. public function validate($columns = null)
  730. {
  731. $res = $this->doValidate($columns);
  732. if ($res === true) {
  733. $this->validationFailures = array();
  734. return true;
  735. } else {
  736. $this->validationFailures = $res;
  737. return false;
  738. }
  739. }
  740. /**
  741. * This function performs the validation work for complex object models.
  742. *
  743. * In addition to checking the current object, all related objects will
  744. * also be validated. If all pass then <code>true</code> is returned; otherwise
  745. * an aggreagated array of ValidationFailed objects will be returned.
  746. *
  747. * @param array $columns Array of column names to validate.
  748. * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  749. */
  750. protected function doValidate($columns = null)
  751. {
  752. if (!$this->alreadyInValidation) {
  753. $this->alreadyInValidation = true;
  754. $retval = null;
  755. $failureMap = array();
  756. if (($retval = KceInstallationErrorPeer::doValidate($this, $columns)) !== true) {
  757. $failureMap = array_merge($failureMap, $retval);
  758. }
  759. $this->alreadyInValidation = false;
  760. }
  761. return (!empty($failureMap) ? $failureMap : true);
  762. }
  763. /**
  764. * Retrieves a field from the object by name passed in as a string.
  765. *
  766. * @param string $name name
  767. * @param string $type The type of fieldname the $name is of:
  768. * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  769. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  770. * @return mixed Value of field.
  771. */
  772. public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
  773. {
  774. $pos = KceInstallationErrorPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  775. $field = $this->getByPosition($pos);
  776. return $field;
  777. }
  778. /**
  779. * Retrieves a field from the object by Position as specified in the xml schema.
  780. * Zero-based.
  781. *
  782. * @param int $pos position in xml schema
  783. * @return mixed Value of field at $pos
  784. */
  785. public function getByPosition($pos)
  786. {
  787. switch($pos) {
  788. case 0:
  789. return $this->getId();
  790. break;
  791. case 1:
  792. return $this->getPartnerId();
  793. break;
  794. case 2:
  795. return $this->getBrowser();
  796. break;
  797. case 3:
  798. return $this->getServerIp();
  799. break;
  800. case 4:
  801. return $this->getServerOs();
  802. break;
  803. case 5:
  804. return $this->getPhpVersion();
  805. break;
  806. case 6:
  807. return $this->getCeAdminEmail();
  808. break;
  809. case 7:
  810. return $this->getType();
  811. break;
  812. case 8:
  813. return $this->getDescription();
  814. break;
  815. case 9:
  816. return $this->getData();
  817. break;
  818. default:
  819. return null;
  820. break;
  821. } // switch()
  822. }
  823. /**
  824. * Exports the object as an array.
  825. *
  826. * You can specify the key type of the array by passing one of the class
  827. * type constants.
  828. *
  829. * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  830. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME.
  831. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  832. * @return an associative array containing the field names (as keys) and field values
  833. */
  834. public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
  835. {
  836. $keys = KceInstallationErrorPeer::getFieldNames($keyType);
  837. $result = array(
  838. $keys[0] => $this->getId(),
  839. $keys[1] => $this->getPartnerId(),
  840. $keys[2] => $this->getBrowser(),
  841. $keys[3] => $this->getServerIp(),
  842. $keys[4] => $this->getServerOs(),
  843. $keys[5] => $this->getPhpVersion(),
  844. $keys[6] => $this->getCeAdminEmail(),
  845. $keys[7] => $this->getType(),
  846. $keys[8] => $this->getDescription(),
  847. $keys[9] => $this->getData(),
  848. );
  849. return $result;
  850. }
  851. /**
  852. * Sets a field from the object by name passed in as a string.
  853. *
  854. * @param string $name peer name
  855. * @param mixed $value field value
  856. * @param string $type The type of fieldname the $name is of:
  857. * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  858. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  859. * @return void
  860. */
  861. public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
  862. {
  863. $pos = KceInstallationErrorPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  864. return $this->setByPosition($pos, $value);
  865. }
  866. /**
  867. * Sets a field from the object by Position as specified in the xml schema.
  868. * Zero-based.
  869. *
  870. * @param int $pos position in xml schema
  871. * @param mixed $value field value
  872. * @return void
  873. */
  874. public function setByPosition($pos, $value)
  875. {
  876. switch($pos) {
  877. case 0:
  878. $this->setId($value);
  879. break;
  880. case 1:
  881. $this->setPartnerId($value);
  882. break;
  883. case 2:
  884. $this->setBrowser($value);
  885. break;
  886. case 3:
  887. $this->setServerIp($value);
  888. break;
  889. case 4:
  890. $this->setServerOs($value);
  891. break;
  892. case 5:
  893. $this->setPhpVersion($value);
  894. break;
  895. case 6:
  896. $this->setCeAdminEmail($value);
  897. break;
  898. case 7:
  899. $this->setType($value);
  900. break;
  901. case 8:
  902. $this->setDescription($value);
  903. break;
  904. case 9:
  905. $this->setData($value);
  906. break;
  907. } // switch()
  908. }
  909. /**
  910. * Populates the object using an array.
  911. *
  912. * This is particularly useful when populating an object from one of the
  913. * request arrays (e.g. $_POST). This method goes through the column
  914. * names, checking to see whether a matching key exists in populated
  915. * array. If so the setByName() method is called for that column.
  916. *
  917. * You can specify the key type of the array by additionally passing one
  918. * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  919. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  920. * The default key type is the column's phpname (e.g. 'AuthorId')
  921. *
  922. * @param array $arr An array to populate the object from.
  923. * @param string $keyType The type of keys the array uses.
  924. * @return void
  925. */
  926. public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
  927. {
  928. $keys = KceInstallationErrorPeer::getFieldNames($keyType);
  929. if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
  930. if (array_key_exists($keys[1], $arr)) $this->setPartnerId($arr[$keys[1]]);
  931. if (array_key_exists($keys[2], $arr)) $this->setBrowser($arr[$keys[2]]);
  932. if (array_key_exists($keys[3], $arr)) $this->setServerIp($arr[$keys[3]]);
  933. if (array_key_exists($keys[4], $arr)) $this->setServerOs($arr[$keys[4]]);
  934. if (array_key_exists($keys[5], $arr)) $this->setPhpVersion($arr[$keys[5]]);
  935. if (array_key_exists($keys[6], $arr)) $this->setCeAdminEmail($arr[$keys[6]]);
  936. if (array_key_exists($keys[7], $arr)) $this->setType($arr[$keys[7]]);
  937. if (array_key_exists($keys[8], $arr)) $this->setDescription($arr[$keys[8]]);
  938. if (array_key_exists($keys[9], $arr)) $this->setData($arr[$keys[9]]);
  939. }
  940. /**
  941. * Build a Criteria object containing the values of all modified columns in this object.
  942. *
  943. * @return Criteria The Criteria object containing all modified values.
  944. */
  945. public function buildCriteria()
  946. {
  947. $criteria = new Criteria(KceInstallationErrorPeer::DATABASE_NAME);
  948. if ($this->isColumnModified(KceInstallationErrorPeer::ID)) $criteria->add(KceInstallationErrorPeer::ID, $this->id);
  949. if ($this->isColumnModified(KceInstallationErrorPeer::PARTNER_ID)) $criteria->add(KceInstallationErrorPeer::PARTNER_ID, $this->partner_id);
  950. if ($this->isColumnModified(KceInstallationErrorPeer::BROWSER)) $criteria->add(KceInstallationErrorPeer::BROWSER, $this->browser);
  951. if ($this->isColumnModified(KceInstallationErrorPeer::SERVER_IP)) $criteria->add(KceInstallationErrorPeer::SERVER_IP, $this->server_ip);
  952. if ($this->isColumnModified(KceInstallationErrorPeer::SERVER_OS)) $criteria->add(KceInstallationErrorPeer::SERVER_OS, $this->server_os);
  953. if ($this->isColumnModified(KceInstallationErrorPeer::PHP_VERSION)) $criteria->add(KceInstallationErrorPeer::PHP_VERSION, $this->php_version);
  954. if ($this->isColumnModified(KceInstallationErrorPeer::CE_ADMIN_EMAIL)) $criteria->add(KceInstallationErrorPeer::CE_ADMIN_EMAIL, $this->ce_admin_email);
  955. if ($this->isColumnModified(KceInstallationErrorPeer::TYPE)) $criteria->add(KceInstallationErrorPeer::TYPE, $this->type);
  956. if ($this->isColumnModified(KceInstallationErrorPeer::DESCRIPTION)) $criteria->add(KceInstallationErrorPeer::DESCRIPTION, $this->description);
  957. if ($this->isColumnModified(KceInstallationErrorPeer::DATA)) $criteria->add(KceInstallationErrorPeer::DATA, $this->data);
  958. return $criteria;
  959. }
  960. /**
  961. * Builds a Criteria object containing the primary key for this object.
  962. *
  963. * Unlike buildCriteria() this method includes the primary key values regardless
  964. * of whether or not they have been modified.
  965. *
  966. * @return Criteria The Criteria object containing value(s) for primary key(s).
  967. */
  968. public function buildPkeyCriteria()
  969. {
  970. $criteria = new Criteria(KceInstallationErrorPeer::DATABASE_NAME);
  971. $criteria->add(KceInstallationErrorPeer::ID, $this->id);
  972. return $criteria;
  973. }
  974. /**
  975. * Returns the primary key for this object (row).
  976. * @return int
  977. */
  978. public function getPrimaryKey()
  979. {
  980. return $this->getId();
  981. }
  982. /**
  983. * Generic method to set the primary key (id column).
  984. *
  985. * @param int $key Primary key.
  986. * @return void
  987. */
  988. public function setPrimaryKey($key)
  989. {
  990. $this->setId($key);
  991. }
  992. /**
  993. * Sets contents of passed object to values from current object.
  994. *
  995. * If desired, this method can also make copies of all associated (fkey referrers)
  996. * objects.
  997. *
  998. * @param object $copyObj An object of KceInstallationError (or compatible) type.
  999. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  1000. * @throws PropelException
  1001. */
  1002. public function copyInto($copyObj, $deepCopy = false)
  1003. {
  1004. $copyObj->setPartnerId($this->partner_id);
  1005. $copyObj->setBrowser($this->browser);
  1006. $copyObj->setServerIp($this->server_ip);
  1007. $copyObj->setServerOs($this->server_os);
  1008. $copyObj->setPhpVersion($this->php_version);
  1009. $copyObj->setCeAdminEmail($this->ce_admin_email);
  1010. $copyObj->setType($this->type);
  1011. $copyObj->setDescription($this->description);
  1012. $copyObj->setData($this->data);
  1013. $copyObj->setNew(true);
  1014. $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
  1015. }
  1016. /**
  1017. * Makes a copy of this object that will be inserted as a new row in table when saved.
  1018. * It creates a new object filling in the simple attributes, but skipping any primary
  1019. * keys that are defined for the table.
  1020. *
  1021. * If desired, this method can also make copies of all associated (fkey referrers)
  1022. * objects.
  1023. *
  1024. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  1025. * @return KceInstallationError Clone of current object.
  1026. * @throws PropelException
  1027. */
  1028. public function copy($deepCopy = false)
  1029. {
  1030. // we use get_class(), because this might be a subclass
  1031. $clazz = get_class($this);
  1032. $copyObj = new $clazz();
  1033. $this->copyInto($copyObj, $deepCopy);
  1034. $copyObj->setCopiedFrom($this);
  1035. return $copyObj;
  1036. }
  1037. /**
  1038. * Stores the source object that this object copied from
  1039. *
  1040. * @var KceInstallationError Clone of current object.
  1041. */
  1042. protected $copiedFrom = null;
  1043. /**
  1044. * Stores the source object that this object copied from
  1045. *
  1046. * @param KceInstallationError $copiedFrom Clone of current object.
  1047. */
  1048. public function setCopiedFrom(KceInstallationError $copiedFrom)
  1049. {
  1050. $this->copiedFrom = $copiedFrom;
  1051. }
  1052. /**
  1053. * Returns a peer instance associated with this om.
  1054. *
  1055. * Since Peer classes are not to have any instance attributes, this method returns the
  1056. * same instance for all member of this class. The method could therefore
  1057. * be static, but this would prevent one from overriding the behavior.
  1058. *
  1059. * @return KceInstallationErrorPeer
  1060. */
  1061. public function getPeer()
  1062. {
  1063. if (self::$peer === null) {
  1064. self::$peer = new KceInstallationErrorPeer();
  1065. }
  1066. return self::$peer;
  1067. }
  1068. /**
  1069. * Resets all collections of referencing foreign keys.
  1070. *
  1071. * This method is a user-space workaround for PHP's inability to garbage collect objects
  1072. * with circular references. This is currently necessary when using Propel in certain
  1073. * daemon or large-volumne/high-memory operations.
  1074. *
  1075. * @param boolean $deep Whether to also clear the references on all associated objects.
  1076. */
  1077. public function clearAllReferences($deep = false)
  1078. {
  1079. if ($deep) {
  1080. } // if ($deep)
  1081. }
  1082. } // BaseKceInstallationError