PageRenderTime 55ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/package/app/app/plugins/drop_folder/lib/model/om/BaseDropFolder.php

https://bitbucket.org/pandaos/kaltura
PHP | 1839 lines | 929 code | 240 blank | 670 comment | 151 complexity | d77765cd0bd02b4be485a1d5a518209e MD5 | raw file
Possible License(s): AGPL-3.0, GPL-3.0, BSD-3-Clause, LGPL-2.1, GPL-2.0, LGPL-3.0, JSON, MPL-2.0-no-copyleft-exception, Apache-2.0

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

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

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