PageRenderTime 58ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/package/app/app/plugins/mysql_search/lib/model/om/BaseSearchEntry.php

https://bitbucket.org/pandaos/kaltura
PHP | 2711 lines | 1457 code | 340 blank | 914 comment | 278 complexity | df2ace71244273bca1f897ea464e0fd7 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 'search_entry' table.
  4. *
  5. *
  6. *
  7. * @package plugins.contentDistribution
  8. * @subpackage model.om
  9. */
  10. abstract class BaseSearchEntry 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 SearchEntryPeer
  16. */
  17. protected static $peer;
  18. /**
  19. * The value for the entry_id field.
  20. * @var string
  21. */
  22. protected $entry_id;
  23. /**
  24. * The value for the kuser_id field.
  25. * @var int
  26. */
  27. protected $kuser_id;
  28. /**
  29. * The value for the name field.
  30. * @var string
  31. */
  32. protected $name;
  33. /**
  34. * The value for the type field.
  35. * @var int
  36. */
  37. protected $type;
  38. /**
  39. * The value for the media_type field.
  40. * @var int
  41. */
  42. protected $media_type;
  43. /**
  44. * The value for the views field.
  45. * Note: this column has a database default value of: 0
  46. * @var int
  47. */
  48. protected $views;
  49. /**
  50. * The value for the rank field.
  51. * Note: this column has a database default value of: 0
  52. * @var int
  53. */
  54. protected $rank;
  55. /**
  56. * The value for the tags field.
  57. * @var string
  58. */
  59. protected $tags;
  60. /**
  61. * The value for the entry_status field.
  62. * @var int
  63. */
  64. protected $entry_status;
  65. /**
  66. * The value for the source_link field.
  67. * @var string
  68. */
  69. protected $source_link;
  70. /**
  71. * The value for the duration field.
  72. * Note: this column has a database default value of: 0
  73. * @var int
  74. */
  75. protected $duration;
  76. /**
  77. * The value for the duration_type field.
  78. * @var string
  79. */
  80. protected $duration_type;
  81. /**
  82. * The value for the created_at field.
  83. * @var string
  84. */
  85. protected $created_at;
  86. /**
  87. * The value for the updated_at field.
  88. * @var string
  89. */
  90. protected $updated_at;
  91. /**
  92. * The value for the partner_id field.
  93. * Note: this column has a database default value of: 0
  94. * @var int
  95. */
  96. protected $partner_id;
  97. /**
  98. * The value for the display_in_search field.
  99. * @var int
  100. */
  101. protected $display_in_search;
  102. /**
  103. * The value for the group_id field.
  104. * @var string
  105. */
  106. protected $group_id;
  107. /**
  108. * The value for the plays field.
  109. * Note: this column has a database default value of: 0
  110. * @var int
  111. */
  112. protected $plays;
  113. /**
  114. * The value for the description field.
  115. * @var string
  116. */
  117. protected $description;
  118. /**
  119. * The value for the media_date field.
  120. * @var string
  121. */
  122. protected $media_date;
  123. /**
  124. * The value for the admin_tags field.
  125. * @var string
  126. */
  127. protected $admin_tags;
  128. /**
  129. * The value for the moderation_status field.
  130. * @var int
  131. */
  132. protected $moderation_status;
  133. /**
  134. * The value for the moderation_count field.
  135. * @var int
  136. */
  137. protected $moderation_count;
  138. /**
  139. * The value for the modified_at field.
  140. * @var string
  141. */
  142. protected $modified_at;
  143. /**
  144. * The value for the access_control_id field.
  145. * @var int
  146. */
  147. protected $access_control_id;
  148. /**
  149. * The value for the categories field.
  150. * @var string
  151. */
  152. protected $categories;
  153. /**
  154. * The value for the start_date field.
  155. * @var string
  156. */
  157. protected $start_date;
  158. /**
  159. * The value for the end_date field.
  160. * @var string
  161. */
  162. protected $end_date;
  163. /**
  164. * The value for the flavor_params field.
  165. * @var string
  166. */
  167. protected $flavor_params;
  168. /**
  169. * The value for the available_from field.
  170. * @var string
  171. */
  172. protected $available_from;
  173. /**
  174. * The value for the plugin_data field.
  175. * @var string
  176. */
  177. protected $plugin_data;
  178. /**
  179. * Flag to prevent endless save loop, if this object is referenced
  180. * by another object which falls in this transaction.
  181. * @var boolean
  182. */
  183. protected $alreadyInSave = false;
  184. /**
  185. * Flag to prevent endless validation loop, if this object is referenced
  186. * by another object which falls in this transaction.
  187. * @var boolean
  188. */
  189. protected $alreadyInValidation = false;
  190. /**
  191. * Store columns old values before the changes
  192. * @var array
  193. */
  194. protected $oldColumnsValues = array();
  195. /**
  196. * @return array
  197. */
  198. public function getColumnsOldValues()
  199. {
  200. return $this->oldColumnsValues;
  201. }
  202. /**
  203. * Applies default values to this object.
  204. * This method should be called from the object's constructor (or
  205. * equivalent initialization method).
  206. * @see __construct()
  207. */
  208. public function applyDefaultValues()
  209. {
  210. $this->views = 0;
  211. $this->rank = 0;
  212. $this->duration = 0;
  213. $this->partner_id = 0;
  214. $this->plays = 0;
  215. }
  216. /**
  217. * Initializes internal state of BaseSearchEntry object.
  218. * @see applyDefaults()
  219. */
  220. public function __construct()
  221. {
  222. parent::__construct();
  223. $this->applyDefaultValues();
  224. }
  225. /**
  226. * Get the [entry_id] column value.
  227. *
  228. * @return string
  229. */
  230. public function getEntryId()
  231. {
  232. return $this->entry_id;
  233. }
  234. /**
  235. * Get the [kuser_id] column value.
  236. *
  237. * @return int
  238. */
  239. public function getKuserId()
  240. {
  241. return $this->kuser_id;
  242. }
  243. /**
  244. * Get the [name] column value.
  245. *
  246. * @return string
  247. */
  248. public function getName()
  249. {
  250. return $this->name;
  251. }
  252. /**
  253. * Get the [type] column value.
  254. *
  255. * @return int
  256. */
  257. public function getType()
  258. {
  259. return $this->type;
  260. }
  261. /**
  262. * Get the [media_type] column value.
  263. *
  264. * @return int
  265. */
  266. public function getMediaType()
  267. {
  268. return $this->media_type;
  269. }
  270. /**
  271. * Get the [views] column value.
  272. *
  273. * @return int
  274. */
  275. public function getViews()
  276. {
  277. return $this->views;
  278. }
  279. /**
  280. * Get the [rank] column value.
  281. *
  282. * @return int
  283. */
  284. public function getRank()
  285. {
  286. return $this->rank;
  287. }
  288. /**
  289. * Get the [tags] column value.
  290. *
  291. * @return string
  292. */
  293. public function getTags()
  294. {
  295. return $this->tags;
  296. }
  297. /**
  298. * Get the [entry_status] column value.
  299. *
  300. * @return int
  301. */
  302. public function getEntryStatus()
  303. {
  304. return $this->entry_status;
  305. }
  306. /**
  307. * Get the [source_link] column value.
  308. *
  309. * @return string
  310. */
  311. public function getSourceLink()
  312. {
  313. return $this->source_link;
  314. }
  315. /**
  316. * Get the [duration] column value.
  317. *
  318. * @return int
  319. */
  320. public function getDuration()
  321. {
  322. return $this->duration;
  323. }
  324. /**
  325. * Get the [duration_type] column value.
  326. *
  327. * @return string
  328. */
  329. public function getDurationType()
  330. {
  331. return $this->duration_type;
  332. }
  333. /**
  334. * Get the [optionally formatted] temporal [created_at] column value.
  335. *
  336. * This accessor only only work with unix epoch dates. Consider enabling the propel.useDateTimeClass
  337. * option in order to avoid converstions to integers (which are limited in the dates they can express).
  338. *
  339. * @param string $format The date/time format string (either date()-style or strftime()-style).
  340. * If format is NULL, then the raw unix timestamp integer will be returned.
  341. * @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
  342. * @throws PropelException - if unable to parse/validate the date/time value.
  343. */
  344. public function getCreatedAt($format = 'Y-m-d H:i:s')
  345. {
  346. if ($this->created_at === null) {
  347. return null;
  348. }
  349. if ($this->created_at === '0000-00-00 00:00:00') {
  350. // while technically this is not a default value of NULL,
  351. // this seems to be closest in meaning.
  352. return null;
  353. } else {
  354. try {
  355. $dt = new DateTime($this->created_at);
  356. } catch (Exception $x) {
  357. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x);
  358. }
  359. }
  360. if ($format === null) {
  361. // We cast here to maintain BC in API; obviously we will lose data if we're dealing with pre-/post-epoch dates.
  362. return (int) $dt->format('U');
  363. } elseif (strpos($format, '%') !== false) {
  364. return strftime($format, $dt->format('U'));
  365. } else {
  366. return $dt->format($format);
  367. }
  368. }
  369. /**
  370. * Get the [optionally formatted] temporal [updated_at] column value.
  371. *
  372. * This accessor only only work with unix epoch dates. Consider enabling the propel.useDateTimeClass
  373. * option in order to avoid converstions to integers (which are limited in the dates they can express).
  374. *
  375. * @param string $format The date/time format string (either date()-style or strftime()-style).
  376. * If format is NULL, then the raw unix timestamp integer will be returned.
  377. * @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
  378. * @throws PropelException - if unable to parse/validate the date/time value.
  379. */
  380. public function getUpdatedAt($format = 'Y-m-d H:i:s')
  381. {
  382. if ($this->updated_at === null) {
  383. return null;
  384. }
  385. if ($this->updated_at === '0000-00-00 00:00:00') {
  386. // while technically this is not a default value of NULL,
  387. // this seems to be closest in meaning.
  388. return null;
  389. } else {
  390. try {
  391. $dt = new DateTime($this->updated_at);
  392. } catch (Exception $x) {
  393. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x);
  394. }
  395. }
  396. if ($format === null) {
  397. // We cast here to maintain BC in API; obviously we will lose data if we're dealing with pre-/post-epoch dates.
  398. return (int) $dt->format('U');
  399. } elseif (strpos($format, '%') !== false) {
  400. return strftime($format, $dt->format('U'));
  401. } else {
  402. return $dt->format($format);
  403. }
  404. }
  405. /**
  406. * Get the [partner_id] column value.
  407. *
  408. * @return int
  409. */
  410. public function getPartnerId()
  411. {
  412. return $this->partner_id;
  413. }
  414. /**
  415. * Get the [display_in_search] column value.
  416. *
  417. * @return int
  418. */
  419. public function getDisplayInSearch()
  420. {
  421. return $this->display_in_search;
  422. }
  423. /**
  424. * Get the [group_id] column value.
  425. *
  426. * @return string
  427. */
  428. public function getGroupId()
  429. {
  430. return $this->group_id;
  431. }
  432. /**
  433. * Get the [plays] column value.
  434. *
  435. * @return int
  436. */
  437. public function getPlays()
  438. {
  439. return $this->plays;
  440. }
  441. /**
  442. * Get the [description] column value.
  443. *
  444. * @return string
  445. */
  446. public function getDescription()
  447. {
  448. return $this->description;
  449. }
  450. /**
  451. * Get the [optionally formatted] temporal [media_date] column value.
  452. *
  453. * This accessor only only work with unix epoch dates. Consider enabling the propel.useDateTimeClass
  454. * option in order to avoid converstions to integers (which are limited in the dates they can express).
  455. *
  456. * @param string $format The date/time format string (either date()-style or strftime()-style).
  457. * If format is NULL, then the raw unix timestamp integer will be returned.
  458. * @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
  459. * @throws PropelException - if unable to parse/validate the date/time value.
  460. */
  461. public function getMediaDate($format = 'Y-m-d H:i:s')
  462. {
  463. if ($this->media_date === null) {
  464. return null;
  465. }
  466. if ($this->media_date === '0000-00-00 00:00:00') {
  467. // while technically this is not a default value of NULL,
  468. // this seems to be closest in meaning.
  469. return null;
  470. } else {
  471. try {
  472. $dt = new DateTime($this->media_date);
  473. } catch (Exception $x) {
  474. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->media_date, true), $x);
  475. }
  476. }
  477. if ($format === null) {
  478. // We cast here to maintain BC in API; obviously we will lose data if we're dealing with pre-/post-epoch dates.
  479. return (int) $dt->format('U');
  480. } elseif (strpos($format, '%') !== false) {
  481. return strftime($format, $dt->format('U'));
  482. } else {
  483. return $dt->format($format);
  484. }
  485. }
  486. /**
  487. * Get the [admin_tags] column value.
  488. *
  489. * @return string
  490. */
  491. public function getAdminTags()
  492. {
  493. return $this->admin_tags;
  494. }
  495. /**
  496. * Get the [moderation_status] column value.
  497. *
  498. * @return int
  499. */
  500. public function getModerationStatus()
  501. {
  502. return $this->moderation_status;
  503. }
  504. /**
  505. * Get the [moderation_count] column value.
  506. *
  507. * @return int
  508. */
  509. public function getModerationCount()
  510. {
  511. return $this->moderation_count;
  512. }
  513. /**
  514. * Get the [optionally formatted] temporal [modified_at] column value.
  515. *
  516. * This accessor only only work with unix epoch dates. Consider enabling the propel.useDateTimeClass
  517. * option in order to avoid converstions to integers (which are limited in the dates they can express).
  518. *
  519. * @param string $format The date/time format string (either date()-style or strftime()-style).
  520. * If format is NULL, then the raw unix timestamp integer will be returned.
  521. * @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
  522. * @throws PropelException - if unable to parse/validate the date/time value.
  523. */
  524. public function getModifiedAt($format = 'Y-m-d H:i:s')
  525. {
  526. if ($this->modified_at === null) {
  527. return null;
  528. }
  529. if ($this->modified_at === '0000-00-00 00:00:00') {
  530. // while technically this is not a default value of NULL,
  531. // this seems to be closest in meaning.
  532. return null;
  533. } else {
  534. try {
  535. $dt = new DateTime($this->modified_at);
  536. } catch (Exception $x) {
  537. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->modified_at, true), $x);
  538. }
  539. }
  540. if ($format === null) {
  541. // We cast here to maintain BC in API; obviously we will lose data if we're dealing with pre-/post-epoch dates.
  542. return (int) $dt->format('U');
  543. } elseif (strpos($format, '%') !== false) {
  544. return strftime($format, $dt->format('U'));
  545. } else {
  546. return $dt->format($format);
  547. }
  548. }
  549. /**
  550. * Get the [access_control_id] column value.
  551. *
  552. * @return int
  553. */
  554. public function getAccessControlId()
  555. {
  556. return $this->access_control_id;
  557. }
  558. /**
  559. * Get the [categories] column value.
  560. *
  561. * @return string
  562. */
  563. public function getCategories()
  564. {
  565. return $this->categories;
  566. }
  567. /**
  568. * Get the [optionally formatted] temporal [start_date] column value.
  569. *
  570. * This accessor only only work with unix epoch dates. Consider enabling the propel.useDateTimeClass
  571. * option in order to avoid converstions to integers (which are limited in the dates they can express).
  572. *
  573. * @param string $format The date/time format string (either date()-style or strftime()-style).
  574. * If format is NULL, then the raw unix timestamp integer will be returned.
  575. * @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
  576. * @throws PropelException - if unable to parse/validate the date/time value.
  577. */
  578. public function getStartDate($format = 'Y-m-d H:i:s')
  579. {
  580. if ($this->start_date === null) {
  581. return null;
  582. }
  583. if ($this->start_date === '0000-00-00 00:00:00') {
  584. // while technically this is not a default value of NULL,
  585. // this seems to be closest in meaning.
  586. return null;
  587. } else {
  588. try {
  589. $dt = new DateTime($this->start_date);
  590. } catch (Exception $x) {
  591. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->start_date, true), $x);
  592. }
  593. }
  594. if ($format === null) {
  595. // We cast here to maintain BC in API; obviously we will lose data if we're dealing with pre-/post-epoch dates.
  596. return (int) $dt->format('U');
  597. } elseif (strpos($format, '%') !== false) {
  598. return strftime($format, $dt->format('U'));
  599. } else {
  600. return $dt->format($format);
  601. }
  602. }
  603. /**
  604. * Get the [optionally formatted] temporal [end_date] column value.
  605. *
  606. * This accessor only only work with unix epoch dates. Consider enabling the propel.useDateTimeClass
  607. * option in order to avoid converstions to integers (which are limited in the dates they can express).
  608. *
  609. * @param string $format The date/time format string (either date()-style or strftime()-style).
  610. * If format is NULL, then the raw unix timestamp integer will be returned.
  611. * @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
  612. * @throws PropelException - if unable to parse/validate the date/time value.
  613. */
  614. public function getEndDate($format = 'Y-m-d H:i:s')
  615. {
  616. if ($this->end_date === null) {
  617. return null;
  618. }
  619. if ($this->end_date === '0000-00-00 00:00:00') {
  620. // while technically this is not a default value of NULL,
  621. // this seems to be closest in meaning.
  622. return null;
  623. } else {
  624. try {
  625. $dt = new DateTime($this->end_date);
  626. } catch (Exception $x) {
  627. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->end_date, true), $x);
  628. }
  629. }
  630. if ($format === null) {
  631. // We cast here to maintain BC in API; obviously we will lose data if we're dealing with pre-/post-epoch dates.
  632. return (int) $dt->format('U');
  633. } elseif (strpos($format, '%') !== false) {
  634. return strftime($format, $dt->format('U'));
  635. } else {
  636. return $dt->format($format);
  637. }
  638. }
  639. /**
  640. * Get the [flavor_params] column value.
  641. *
  642. * @return string
  643. */
  644. public function getFlavorParams()
  645. {
  646. return $this->flavor_params;
  647. }
  648. /**
  649. * Get the [optionally formatted] temporal [available_from] column value.
  650. *
  651. * This accessor only only work with unix epoch dates. Consider enabling the propel.useDateTimeClass
  652. * option in order to avoid converstions to integers (which are limited in the dates they can express).
  653. *
  654. * @param string $format The date/time format string (either date()-style or strftime()-style).
  655. * If format is NULL, then the raw unix timestamp integer will be returned.
  656. * @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
  657. * @throws PropelException - if unable to parse/validate the date/time value.
  658. */
  659. public function getAvailableFrom($format = 'Y-m-d H:i:s')
  660. {
  661. if ($this->available_from === null) {
  662. return null;
  663. }
  664. if ($this->available_from === '0000-00-00 00:00:00') {
  665. // while technically this is not a default value of NULL,
  666. // this seems to be closest in meaning.
  667. return null;
  668. } else {
  669. try {
  670. $dt = new DateTime($this->available_from);
  671. } catch (Exception $x) {
  672. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->available_from, true), $x);
  673. }
  674. }
  675. if ($format === null) {
  676. // We cast here to maintain BC in API; obviously we will lose data if we're dealing with pre-/post-epoch dates.
  677. return (int) $dt->format('U');
  678. } elseif (strpos($format, '%') !== false) {
  679. return strftime($format, $dt->format('U'));
  680. } else {
  681. return $dt->format($format);
  682. }
  683. }
  684. /**
  685. * Get the [plugin_data] column value.
  686. *
  687. * @return string
  688. */
  689. public function getPluginData()
  690. {
  691. return $this->plugin_data;
  692. }
  693. /**
  694. * Set the value of [entry_id] column.
  695. *
  696. * @param string $v new value
  697. * @return SearchEntry The current object (for fluent API support)
  698. */
  699. public function setEntryId($v)
  700. {
  701. if(!isset($this->oldColumnsValues[SearchEntryPeer::ENTRY_ID]))
  702. $this->oldColumnsValues[SearchEntryPeer::ENTRY_ID] = $this->entry_id;
  703. if ($v !== null) {
  704. $v = (string) $v;
  705. }
  706. if ($this->entry_id !== $v) {
  707. $this->entry_id = $v;
  708. $this->modifiedColumns[] = SearchEntryPeer::ENTRY_ID;
  709. }
  710. return $this;
  711. } // setEntryId()
  712. /**
  713. * Set the value of [kuser_id] column.
  714. *
  715. * @param int $v new value
  716. * @return SearchEntry The current object (for fluent API support)
  717. */
  718. public function setKuserId($v)
  719. {
  720. if(!isset($this->oldColumnsValues[SearchEntryPeer::KUSER_ID]))
  721. $this->oldColumnsValues[SearchEntryPeer::KUSER_ID] = $this->kuser_id;
  722. if ($v !== null) {
  723. $v = (int) $v;
  724. }
  725. if ($this->kuser_id !== $v) {
  726. $this->kuser_id = $v;
  727. $this->modifiedColumns[] = SearchEntryPeer::KUSER_ID;
  728. }
  729. return $this;
  730. } // setKuserId()
  731. /**
  732. * Set the value of [name] column.
  733. *
  734. * @param string $v new value
  735. * @return SearchEntry The current object (for fluent API support)
  736. */
  737. public function setName($v)
  738. {
  739. if(!isset($this->oldColumnsValues[SearchEntryPeer::NAME]))
  740. $this->oldColumnsValues[SearchEntryPeer::NAME] = $this->name;
  741. if ($v !== null) {
  742. $v = (string) $v;
  743. }
  744. if ($this->name !== $v) {
  745. $this->name = $v;
  746. $this->modifiedColumns[] = SearchEntryPeer::NAME;
  747. }
  748. return $this;
  749. } // setName()
  750. /**
  751. * Set the value of [type] column.
  752. *
  753. * @param int $v new value
  754. * @return SearchEntry The current object (for fluent API support)
  755. */
  756. public function setType($v)
  757. {
  758. if(!isset($this->oldColumnsValues[SearchEntryPeer::TYPE]))
  759. $this->oldColumnsValues[SearchEntryPeer::TYPE] = $this->type;
  760. if ($v !== null) {
  761. $v = (int) $v;
  762. }
  763. if ($this->type !== $v) {
  764. $this->type = $v;
  765. $this->modifiedColumns[] = SearchEntryPeer::TYPE;
  766. }
  767. return $this;
  768. } // setType()
  769. /**
  770. * Set the value of [media_type] column.
  771. *
  772. * @param int $v new value
  773. * @return SearchEntry The current object (for fluent API support)
  774. */
  775. public function setMediaType($v)
  776. {
  777. if(!isset($this->oldColumnsValues[SearchEntryPeer::MEDIA_TYPE]))
  778. $this->oldColumnsValues[SearchEntryPeer::MEDIA_TYPE] = $this->media_type;
  779. if ($v !== null) {
  780. $v = (int) $v;
  781. }
  782. if ($this->media_type !== $v) {
  783. $this->media_type = $v;
  784. $this->modifiedColumns[] = SearchEntryPeer::MEDIA_TYPE;
  785. }
  786. return $this;
  787. } // setMediaType()
  788. /**
  789. * Set the value of [views] column.
  790. *
  791. * @param int $v new value
  792. * @return SearchEntry The current object (for fluent API support)
  793. */
  794. public function setViews($v)
  795. {
  796. if(!isset($this->oldColumnsValues[SearchEntryPeer::VIEWS]))
  797. $this->oldColumnsValues[SearchEntryPeer::VIEWS] = $this->views;
  798. if ($v !== null) {
  799. $v = (int) $v;
  800. }
  801. if ($this->views !== $v || $this->isNew()) {
  802. $this->views = $v;
  803. $this->modifiedColumns[] = SearchEntryPeer::VIEWS;
  804. }
  805. return $this;
  806. } // setViews()
  807. /**
  808. * Set the value of [rank] column.
  809. *
  810. * @param int $v new value
  811. * @return SearchEntry The current object (for fluent API support)
  812. */
  813. public function setRank($v)
  814. {
  815. if(!isset($this->oldColumnsValues[SearchEntryPeer::RANK]))
  816. $this->oldColumnsValues[SearchEntryPeer::RANK] = $this->rank;
  817. if ($v !== null) {
  818. $v = (int) $v;
  819. }
  820. if ($this->rank !== $v || $this->isNew()) {
  821. $this->rank = $v;
  822. $this->modifiedColumns[] = SearchEntryPeer::RANK;
  823. }
  824. return $this;
  825. } // setRank()
  826. /**
  827. * Set the value of [tags] column.
  828. *
  829. * @param string $v new value
  830. * @return SearchEntry The current object (for fluent API support)
  831. */
  832. public function setTags($v)
  833. {
  834. if(!isset($this->oldColumnsValues[SearchEntryPeer::TAGS]))
  835. $this->oldColumnsValues[SearchEntryPeer::TAGS] = $this->tags;
  836. if ($v !== null) {
  837. $v = (string) $v;
  838. }
  839. if ($this->tags !== $v) {
  840. $this->tags = $v;
  841. $this->modifiedColumns[] = SearchEntryPeer::TAGS;
  842. }
  843. return $this;
  844. } // setTags()
  845. /**
  846. * Set the value of [entry_status] column.
  847. *
  848. * @param int $v new value
  849. * @return SearchEntry The current object (for fluent API support)
  850. */
  851. public function setEntryStatus($v)
  852. {
  853. if(!isset($this->oldColumnsValues[SearchEntryPeer::ENTRY_STATUS]))
  854. $this->oldColumnsValues[SearchEntryPeer::ENTRY_STATUS] = $this->entry_status;
  855. if ($v !== null) {
  856. $v = (int) $v;
  857. }
  858. if ($this->entry_status !== $v) {
  859. $this->entry_status = $v;
  860. $this->modifiedColumns[] = SearchEntryPeer::ENTRY_STATUS;
  861. }
  862. return $this;
  863. } // setEntryStatus()
  864. /**
  865. * Set the value of [source_link] column.
  866. *
  867. * @param string $v new value
  868. * @return SearchEntry The current object (for fluent API support)
  869. */
  870. public function setSourceLink($v)
  871. {
  872. if(!isset($this->oldColumnsValues[SearchEntryPeer::SOURCE_LINK]))
  873. $this->oldColumnsValues[SearchEntryPeer::SOURCE_LINK] = $this->source_link;
  874. if ($v !== null) {
  875. $v = (string) $v;
  876. }
  877. if ($this->source_link !== $v) {
  878. $this->source_link = $v;
  879. $this->modifiedColumns[] = SearchEntryPeer::SOURCE_LINK;
  880. }
  881. return $this;
  882. } // setSourceLink()
  883. /**
  884. * Set the value of [duration] column.
  885. *
  886. * @param int $v new value
  887. * @return SearchEntry The current object (for fluent API support)
  888. */
  889. public function setDuration($v)
  890. {
  891. if(!isset($this->oldColumnsValues[SearchEntryPeer::DURATION]))
  892. $this->oldColumnsValues[SearchEntryPeer::DURATION] = $this->duration;
  893. if ($v !== null) {
  894. $v = (int) $v;
  895. }
  896. if ($this->duration !== $v || $this->isNew()) {
  897. $this->duration = $v;
  898. $this->modifiedColumns[] = SearchEntryPeer::DURATION;
  899. }
  900. return $this;
  901. } // setDuration()
  902. /**
  903. * Set the value of [duration_type] column.
  904. *
  905. * @param string $v new value
  906. * @return SearchEntry The current object (for fluent API support)
  907. */
  908. public function setDurationType($v)
  909. {
  910. if(!isset($this->oldColumnsValues[SearchEntryPeer::DURATION_TYPE]))
  911. $this->oldColumnsValues[SearchEntryPeer::DURATION_TYPE] = $this->duration_type;
  912. if ($v !== null) {
  913. $v = (string) $v;
  914. }
  915. if ($this->duration_type !== $v) {
  916. $this->duration_type = $v;
  917. $this->modifiedColumns[] = SearchEntryPeer::DURATION_TYPE;
  918. }
  919. return $this;
  920. } // setDurationType()
  921. /**
  922. * Sets the value of [created_at] column to a normalized version of the date/time value specified.
  923. *
  924. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  925. * be treated as NULL for temporal objects.
  926. * @return SearchEntry The current object (for fluent API support)
  927. */
  928. public function setCreatedAt($v)
  929. {
  930. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  931. // -- which is unexpected, to say the least.
  932. if ($v === null || $v === '') {
  933. $dt = null;
  934. } elseif ($v instanceof DateTime) {
  935. $dt = $v;
  936. } else {
  937. // some string/numeric value passed; we normalize that so that we can
  938. // validate it.
  939. try {
  940. if (is_numeric($v)) { // if it's a unix timestamp
  941. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  942. // We have to explicitly specify and then change the time zone because of a
  943. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  944. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  945. } else {
  946. $dt = new DateTime($v);
  947. }
  948. } catch (Exception $x) {
  949. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  950. }
  951. }
  952. if ( $this->created_at !== null || $dt !== null ) {
  953. // (nested ifs are a little easier to read in this case)
  954. $currNorm = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
  955. $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null;
  956. if ( ($currNorm !== $newNorm) // normalized values don't match
  957. )
  958. {
  959. $this->created_at = ($dt ? $dt->format('Y-m-d H:i:s') : null);
  960. $this->modifiedColumns[] = SearchEntryPeer::CREATED_AT;
  961. }
  962. } // if either are not null
  963. return $this;
  964. } // setCreatedAt()
  965. /**
  966. * Sets the value of [updated_at] column to a normalized version of the date/time value specified.
  967. *
  968. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  969. * be treated as NULL for temporal objects.
  970. * @return SearchEntry The current object (for fluent API support)
  971. */
  972. public function setUpdatedAt($v)
  973. {
  974. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  975. // -- which is unexpected, to say the least.
  976. if ($v === null || $v === '') {
  977. $dt = null;
  978. } elseif ($v instanceof DateTime) {
  979. $dt = $v;
  980. } else {
  981. // some string/numeric value passed; we normalize that so that we can
  982. // validate it.
  983. try {
  984. if (is_numeric($v)) { // if it's a unix timestamp
  985. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  986. // We have to explicitly specify and then change the time zone because of a
  987. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  988. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  989. } else {
  990. $dt = new DateTime($v);
  991. }
  992. } catch (Exception $x) {
  993. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  994. }
  995. }
  996. if ( $this->updated_at !== null || $dt !== null ) {
  997. // (nested ifs are a little easier to read in this case)
  998. $currNorm = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
  999. $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null;
  1000. if ( ($currNorm !== $newNorm) // normalized values don't match
  1001. )
  1002. {
  1003. $this->updated_at = ($dt ? $dt->format('Y-m-d H:i:s') : null);
  1004. $this->modifiedColumns[] = SearchEntryPeer::UPDATED_AT;
  1005. }
  1006. } // if either are not null
  1007. return $this;
  1008. } // setUpdatedAt()
  1009. /**
  1010. * Set the value of [partner_id] column.
  1011. *
  1012. * @param int $v new value
  1013. * @return SearchEntry The current object (for fluent API support)
  1014. */
  1015. public function setPartnerId($v)
  1016. {
  1017. if(!isset($this->oldColumnsValues[SearchEntryPeer::PARTNER_ID]))
  1018. $this->oldColumnsValues[SearchEntryPeer::PARTNER_ID] = $this->partner_id;
  1019. if ($v !== null) {
  1020. $v = (int) $v;
  1021. }
  1022. if ($this->partner_id !== $v || $this->isNew()) {
  1023. $this->partner_id = $v;
  1024. $this->modifiedColumns[] = SearchEntryPeer::PARTNER_ID;
  1025. }
  1026. return $this;
  1027. } // setPartnerId()
  1028. /**
  1029. * Set the value of [display_in_search] column.
  1030. *
  1031. * @param int $v new value
  1032. * @return SearchEntry The current object (for fluent API support)
  1033. */
  1034. public function setDisplayInSearch($v)
  1035. {
  1036. if(!isset($this->oldColumnsValues[SearchEntryPeer::DISPLAY_IN_SEARCH]))
  1037. $this->oldColumnsValues[SearchEntryPeer::DISPLAY_IN_SEARCH] = $this->display_in_search;
  1038. if ($v !== null) {
  1039. $v = (int) $v;
  1040. }
  1041. if ($this->display_in_search !== $v) {
  1042. $this->display_in_search = $v;
  1043. $this->modifiedColumns[] = SearchEntryPeer::DISPLAY_IN_SEARCH;
  1044. }
  1045. return $this;
  1046. } // setDisplayInSearch()
  1047. /**
  1048. * Set the value of [group_id] column.
  1049. *
  1050. * @param string $v new value
  1051. * @return SearchEntry The current object (for fluent API support)
  1052. */
  1053. public function setGroupId($v)
  1054. {
  1055. if(!isset($this->oldColumnsValues[SearchEntryPeer::GROUP_ID]))
  1056. $this->oldColumnsValues[SearchEntryPeer::GROUP_ID] = $this->group_id;
  1057. if ($v !== null) {
  1058. $v = (string) $v;
  1059. }
  1060. if ($this->group_id !== $v) {
  1061. $this->group_id = $v;
  1062. $this->modifiedColumns[] = SearchEntryPeer::GROUP_ID;
  1063. }
  1064. return $this;
  1065. } // setGroupId()
  1066. /**
  1067. * Set the value of [plays] column.
  1068. *
  1069. * @param int $v new value
  1070. * @return SearchEntry The current object (for fluent API support)
  1071. */
  1072. public function setPlays($v)
  1073. {
  1074. if(!isset($this->oldColumnsValues[SearchEntryPeer::PLAYS]))
  1075. $this->oldColumnsValues[SearchEntryPeer::PLAYS] = $this->plays;
  1076. if ($v !== null) {
  1077. $v = (int) $v;
  1078. }
  1079. if ($this->plays !== $v || $this->isNew()) {
  1080. $this->plays = $v;
  1081. $this->modifiedColumns[] = SearchEntryPeer::PLAYS;
  1082. }
  1083. return $this;
  1084. } // setPlays()
  1085. /**
  1086. * Set the value of [description] column.
  1087. *
  1088. * @param string $v new value
  1089. * @return SearchEntry The current object (for fluent API support)
  1090. */
  1091. public function setDescription($v)
  1092. {
  1093. if(!isset($this->oldColumnsValues[SearchEntryPeer::DESCRIPTION]))
  1094. $this->oldColumnsValues[SearchEntryPeer::DESCRIPTION] = $this->description;
  1095. if ($v !== null) {
  1096. $v = (string) $v;
  1097. }
  1098. if ($this->description !== $v) {
  1099. $this->description = $v;
  1100. $this->modifiedColumns[] = SearchEntryPeer::DESCRIPTION;
  1101. }
  1102. return $this;
  1103. } // setDescription()
  1104. /**
  1105. * Sets the value of [media_date] column to a normalized version of the date/time value specified.
  1106. *
  1107. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  1108. * be treated as NULL for temporal objects.
  1109. * @return SearchEntry The current object (for fluent API support)
  1110. */
  1111. public function setMediaDate($v)
  1112. {
  1113. if(!isset($this->oldColumnsValues[SearchEntryPeer::MEDIA_DATE]))
  1114. $this->oldColumnsValues[SearchEntryPeer::MEDIA_DATE] = $this->media_date;
  1115. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  1116. // -- which is unexpected, to say the least.
  1117. if ($v === null || $v === '') {
  1118. $dt = null;
  1119. } elseif ($v instanceof DateTime) {
  1120. $dt = $v;
  1121. } else {
  1122. // some string/numeric value passed; we normalize that so that we can
  1123. // validate it.
  1124. try {
  1125. if (is_numeric($v)) { // if it's a unix timestamp
  1126. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  1127. // We have to explicitly specify and then change the time zone because of a
  1128. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  1129. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  1130. } else {
  1131. $dt = new DateTime($v);
  1132. }
  1133. } catch (Exception $x) {
  1134. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  1135. }
  1136. }
  1137. if ( $this->media_date !== null || $dt !== null ) {
  1138. // (nested ifs are a little easier to read in this case)
  1139. $currNorm = ($this->media_date !== null && $tmpDt = new DateTime($this->media_date)) ? $tmpDt->format('Y-m-d H:i:s') : null;
  1140. $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null;
  1141. if ( ($currNorm !== $newNorm) // normalized values don't match
  1142. )
  1143. {
  1144. $this->media_date = ($dt ? $dt->format('Y-m-d H:i:s') : null);
  1145. $this->modifiedColumns[] = SearchEntryPeer::MEDIA_DATE;
  1146. }
  1147. } // if either are not null
  1148. return $this;
  1149. } // setMediaDate()
  1150. /**
  1151. * Set the value of [admin_tags] column.
  1152. *
  1153. * @param string $v new value
  1154. * @return SearchEntry The current object (for fluent API support)
  1155. */
  1156. public function setAdminTags($v)
  1157. {
  1158. if(!isset($this->oldColumnsValues[SearchEntryPeer::ADMIN_TAGS]))
  1159. $this->oldColumnsValues[SearchEntryPeer::ADMIN_TAGS] = $this->admin_tags;
  1160. if ($v !== null) {
  1161. $v = (string) $v;
  1162. }
  1163. if ($this->admin_tags !== $v) {
  1164. $this->admin_tags = $v;
  1165. $this->modifiedColumns[] = SearchEntryPeer::ADMIN_TAGS;
  1166. }
  1167. return $this;
  1168. } // setAdminTags()
  1169. /**
  1170. * Set the value of [moderation_status] column.
  1171. *
  1172. * @param int $v new value
  1173. * @return SearchEntry The current object (for fluent API support)
  1174. */
  1175. public function setModerationStatus($v)
  1176. {
  1177. if(!isset($this->oldColumnsValues[SearchEntryPeer::MODERATION_STATUS]))
  1178. $this->oldColumnsValues[SearchEntryPeer::MODERATION_STATUS] = $this->moderation_status;
  1179. if ($v !== null) {
  1180. $v = (int) $v;
  1181. }
  1182. if ($this->moderation_status !== $v) {
  1183. $this->moderation_status = $v;
  1184. $this->modifiedColumns[] = SearchEntryPeer::MODERATION_STATUS;
  1185. }
  1186. return $this;
  1187. } // setModerationStatus()
  1188. /**
  1189. * Set the value of [moderation_count] column.
  1190. *
  1191. * @param int $v new value
  1192. * @return SearchEntry The current object (for fluent API support)
  1193. */
  1194. public function setModerationCount($v)
  1195. {
  1196. if(!isset($this->oldColumnsValues[SearchEntryPeer::MODERATION_COUNT]))
  1197. $this->oldColumnsValues[SearchEntryPeer::MODERATION_COUNT] = $this->moderation_count;
  1198. if ($v !== null) {
  1199. $v = (int) $v;
  1200. }
  1201. if ($this->moderation_count !== $v) {
  1202. $this->moderation_count = $v;
  1203. $this->modifiedColumns[] = SearchEntryPeer::MODERATION_COUNT;
  1204. }
  1205. return $this;
  1206. } // setModerationCount()
  1207. /**
  1208. * Sets the value of [modified_at] column to a normalized version of the date/time value specified.
  1209. *
  1210. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  1211. * be treated as NULL for temporal objects.
  1212. * @return SearchEntry The current object (for fluent API support)
  1213. */
  1214. public function setModifiedAt($v)
  1215. {
  1216. if(!isset($this->oldColumnsValues[SearchEntryPeer::MODIFIED_AT]))
  1217. $this->oldColumnsValues[SearchEntryPeer::MODIFIED_AT] = $this->modified_at;
  1218. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  1219. // -- which is unexpected, to say the least.
  1220. if ($v === null || $v === '') {
  1221. $dt = null;
  1222. } elseif ($v instanceof DateTime) {
  1223. $dt = $v;
  1224. } else {
  1225. // some string/numeric value passed; we normalize that so that we can
  1226. // validate it.
  1227. try {
  1228. if (is_numeric($v)) { // if it's a unix timestamp
  1229. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  1230. // We have to explicitly specify and then change the time zone because of a
  1231. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  1232. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  1233. } else {
  1234. $dt = new DateTime($v);
  1235. }
  1236. } catch (Exception $x) {
  1237. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  1238. }
  1239. }
  1240. if ( $this->modified_at !== null || $dt !== null ) {
  1241. // (nested ifs are a little easier to read in this case)
  1242. $currNorm = ($this->modified_at !== null && $tmpDt = new DateTime($this->modified_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
  1243. $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null;
  1244. if ( ($currNorm !== $newNorm) // normalized values don't match
  1245. )
  1246. {
  1247. $this->modified_at = ($dt ? $dt->format('Y-m-d H:i:s') : null);
  1248. $this->modifiedColumns[] = SearchEntryPeer::MODIFIED_AT;
  1249. }
  1250. } // if either are not null
  1251. return $this;
  1252. } // setModifiedAt()
  1253. /**
  1254. * Set the value of [access_control_id] column.
  1255. *
  1256. * @param int $v new value
  1257. * @return SearchEntry The current object (for fluent API support)
  1258. */
  1259. public function setAccessControlId($v)
  1260. {
  1261. if(!isset($this->oldColumnsValues[SearchEntryPeer::ACCESS_CONTROL_ID]))
  1262. $this->oldColumnsValues[SearchEntryPeer::ACCESS_CONTROL_ID] = $this->access_control_id;
  1263. if ($v !== null) {
  1264. $v = (int) $v;
  1265. }
  1266. if ($this->access_control_id !== $v) {
  1267. $this->access_control_id = $v;
  1268. $this->modifiedColumns[] = SearchEntryPeer::ACCESS_CONTROL_ID;
  1269. }
  1270. return $this;
  1271. } // setAccessControlId()
  1272. /**
  1273. * Set the value of [categories] column.
  1274. *
  1275. * @param string $v new value
  1276. * @return SearchEntry The current object (for fluent API support)
  1277. */
  1278. public function setCategories($v)
  1279. {
  1280. if(!isset($this->oldColumnsValues[SearchEntryPeer::CATEGORIES]))
  1281. $this->oldColumnsValues[SearchEntryPeer::CATEGORIES] = $this->categories;
  1282. if ($v !== null) {
  1283. $v = (string) $v;
  1284. }
  1285. if ($this->categories !== $v) {
  1286. $this->categories = $v;
  1287. $this->modifiedColumns[] = SearchEntryPeer::CATEGORIES;
  1288. }
  1289. return $this;
  1290. } // setCategories()
  1291. /**
  1292. * Sets the value of [start_date] column to a normalized version of the date/time value specified.
  1293. *
  1294. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  1295. * be treated as NULL for temporal objects.
  1296. * @return SearchEntry The current object (for fluent API support)
  1297. */
  1298. public function setStartDate($v)
  1299. {
  1300. if(!isset($this->oldColumnsValues[SearchEntryPeer::START_DATE]))
  1301. $this->oldColumnsValues[SearchEntryPeer::START_DATE] = $this->start_date;
  1302. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  1303. // -- which is unexpected, to say the least.
  1304. if ($v === null || $v === '') {
  1305. $dt = null;
  1306. } elseif ($v instanceof DateTime) {
  1307. $dt = $v;
  1308. } else {
  1309. // some string/numeric value passed; we normalize that so that we can
  1310. // validate it.
  1311. try {
  1312. if (is_numeric($v)) { // if it's a unix timestamp
  1313. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  1314. // We have to explicitly specify and then change the time zone because of a
  1315. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  1316. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  1317. } else {
  1318. $dt = new DateTime($v);
  1319. }
  1320. } catch (Exception $x) {
  1321. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  1322. }
  1323. }
  1324. if ( $this->start_date !== null || $dt !== null ) {
  1325. // (nested ifs are a little easier to read in this case)
  1326. $currNorm = ($this->start_date !== null && $tmpDt = new DateTime($this->start_date)) ? $tmpDt->format('Y-m-d H:i:s') : null;
  1327. $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null;
  1328. if ( ($currNorm !== $newNorm) // normalized values don't match
  1329. )
  1330. {
  1331. $this->start_date = ($dt ? $dt->format('Y-m-d H:i:s') : null);
  1332. $this->modifiedColumns[] = SearchEntryPeer::START_DATE;
  1333. }
  1334. } // if either are not null
  1335. return $this;
  1336. } // setStartDate()
  1337. /**
  1338. * Sets the value of [end_date] column to a normalized version of the date/time value specified.
  1339. *
  1340. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  1341. * be treated as NULL for temporal objects.
  1342. * @return SearchEntry The current object (for fluent API support)
  1343. */
  1344. public function setEndDate($v)
  1345. {
  1346. if(!isset($this->oldColumnsValues[SearchEntryPeer::END_DATE]))
  1347. $this->oldColumnsValues[SearchEntryPeer::END_DATE] = $this->end_date;
  1348. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  1349. // -- which is unexpected, to say the least.
  1350. if ($v === null || $v === '') {
  1351. $dt = null;
  1352. } elseif ($v instanceof DateTime) {
  1353. $dt = $v;
  1354. } else {
  1355. // some string/numeric value passed; we normalize that so that we can
  1356. // validate it.
  1357. try {
  1358. if (is_numeric($v)) { // if it's a unix timestamp
  1359. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  1360. // We have to explicitly specify and then change the time zone because of a
  1361. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  1362. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  1363. } else {
  1364. $dt = new DateTime($v);
  1365. }
  1366. } catch (Exception $x) {
  1367. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  1368. }
  1369. }
  1370. if ( $this->end_date !== null || $dt !== null ) {
  1371. // (nested ifs are a little easier to read in this case)
  1372. $currNorm = ($this->end_date !== null && $tmpDt = new DateTime($this->end_date)) ? $tmpDt->format('Y-m-d H:i:s') : null;
  1373. $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null;
  1374. if ( ($currNorm !== $newNorm) // normalized values don't match
  1375. )
  1376. {
  1377. $this->end_date = ($dt ? $dt->format('Y-m-d H:i:s') : null);
  1378. $this->modifiedColumns[] = SearchEntryPeer::END_DATE;
  1379. }
  1380. } // if either are not null
  1381. return $this;
  1382. } // setEndDate()
  1383. /**
  1384. * Set the value of [flavor_params] column.
  1385. *
  1386. * @param string $v new value
  1387. * @return SearchEntry The current object (for fluent API support)
  1388. */
  1389. public function setFlavorParams($v)
  1390. {
  1391. if(!isset($this->oldColumnsValues[SearchEntryPeer::FLAVOR_PARAMS]))
  1392. $this->oldColumnsValues[SearchEntryPeer::FLAVOR_PARAMS] = $this->flavor_params;
  1393. if ($v !== null) {
  1394. $v = (string) $v;
  1395. }
  1396. if ($this->flavor_params !== $v) {
  1397. $this->flavor_params = $v;
  1398. $this->modifiedColumns[] = SearchEntryPeer::FLAVOR_PARAMS;
  1399. }
  1400. return $this;
  1401. } // setFlavorParams()
  1402. /**
  1403. * Sets the value of [available_from] column to a normalized version of the date/time value specified.
  1404. *
  1405. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  1406. * be treated as NULL for temporal objects.
  1407. * @return SearchEntry The current object (for fluent API support)
  1408. */
  1409. public function setAvailableFrom($v)
  1410. {
  1411. if(!isset($this->oldColumnsValues[SearchEntryPeer::AVAILABLE_FROM]))
  1412. $this->oldColumnsValues[SearchEntryPeer::AVAILABLE_FROM] = $this->available_from;
  1413. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  1414. // -- which is unexpected, to say the least.
  1415. if ($v === null || $v === '') {
  1416. $dt = null;
  1417. } elseif ($v instanceof DateTime) {
  1418. $dt = $v;
  1419. } else {
  1420. // some string/numeric value passed; we normalize that so that we can
  1421. // validate it.
  1422. try {
  1423. if (is_numeric($v)) { // if it's a unix timestamp
  1424. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  1425. // We have to explicitly specify and then change the time zone because of a
  1426. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  1427. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  1428. } else {
  1429. $dt = new DateTime($v);
  1430. }
  1431. } catch (Exception $x) {
  1432. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  1433. }
  1434. }
  1435. if ( $this->available_from !== null || $dt !== null ) {
  1436. // (nested ifs are a little easier to read in this case)
  1437. $currNorm = ($this->available_from !== null && $tmpDt = new DateTime($this->available_from)) ? $tmpDt->format('Y-m-d H:i:s') : null;
  1438. $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null;
  1439. if ( ($currNorm !== $newNorm) // normalized values don't match
  1440. )
  1441. {
  1442. $this->available_from = ($dt ? $dt->format('Y-m-d H:i:s') : null);
  1443. $this->modifiedColumns[] = SearchEntryPeer::AVAILABLE_FROM;
  1444. }
  1445. } // if either are not null
  1446. return $this;
  1447. } // setAvailableFrom()
  1448. /**
  1449. * Set the value of [plugin_data] column.
  1450. *
  1451. * @param string $v new value
  1452. * @return SearchEntry The current object (for fluent API support)
  1453. */
  1454. public function setPluginData($v)
  1455. {
  1456. if(!isset($this->oldColumnsValues[SearchEntryPeer::PLUGIN_DATA]))
  1457. $this->oldColumnsValues[SearchEntryPeer::PLUGIN_DATA] = $this->plugin_data;
  1458. if ($v !== null) {
  1459. $v = (string) $v;
  1460. }
  1461. if ($this->plugin_data !== $v) {
  1462. $this->plugin_data = $v;
  1463. $this->modifiedColumns[] = SearchEntryPeer::PLUGIN_DATA;
  1464. }
  1465. return $this;
  1466. } // setPluginData()
  1467. /**
  1468. * Indicates whether the columns in this object are only set to default values.
  1469. *
  1470. * This method can be used in conjunction with isModified() to indicate whether an object is both
  1471. * modified _and_ has some values set which are non-default.
  1472. *
  1473. * @return boolean Whether the columns in this object are only been set with default values.
  1474. */
  1475. public function hasOnlyDefaultValues()
  1476. {
  1477. if ($this->views !== 0) {
  1478. return false;
  1479. }
  1480. if ($this->rank !== 0) {
  1481. return false;
  1482. }
  1483. if ($this->duration !== 0) {
  1484. return false;
  1485. }
  1486. if ($this->partner_id !== 0) {
  1487. return false;
  1488. }
  1489. if ($this->plays !== 0) {
  1490. return false;
  1491. }
  1492. // otherwise, everything was equal, so return TRUE
  1493. return true;
  1494. } // hasOnlyDefaultValues()
  1495. /**
  1496. * Hydrates (populates) the object variables with values from the database resultset.
  1497. *
  1498. * An offset (0-based "start column") is specified so that objects can be hydrated
  1499. * with a subset of the columns in the resultset rows. This is needed, for example,
  1500. * for results of JOIN queries where the resultset row includes columns from two or
  1501. * more tables.
  1502. *
  1503. * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
  1504. * @param int $startcol 0-based offset column which indicates which restultset column to start with.
  1505. * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
  1506. * @return int next starting column
  1507. * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
  1508. */
  1509. public function hydrate($row, $startcol = 0, $rehydrate = false)
  1510. {
  1511. try {
  1512. $this->entry_id = ($row[$startcol + 0] !== null) ? (string) $row[$startcol + 0] : null;
  1513. $this->kuser_id = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
  1514. $this->name = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
  1515. $this->type = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
  1516. $this->media_type = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
  1517. $this->views = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
  1518. $this->rank = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
  1519. $this->tags = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
  1520. $this->entry_status = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null;
  1521. $this->source_link = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
  1522. $this->duration = ($row[$startcol + 10] !== null) ? (int) $row[$startcol + 10] : null;
  1523. $this->duration_type = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
  1524. $this->created_at = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null;
  1525. $this->updated_at = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null;
  1526. $this->partner_id = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null;
  1527. $this->display_in_search = ($row[$startcol + 15] !== null) ? (int) $row[$startcol + 15] : null;
  1528. $this->group_id = ($row[$startcol + 16] !== null) ? (string) $row[$startcol + 16] : null;
  1529. $this->plays = ($row[$startcol + 17] !== null) ? (int) $row[$startcol + 17] : null;
  1530. $this->description = ($row[$startcol + 18] !== null) ? (string) $row[$startcol + 18] : null;
  1531. $this->media_date = ($row[$startcol + 19] !== null) ? (string) $row[$startcol + 19] : null;
  1532. $this->admin_tags = ($row[$startcol + 20] !== null) ? (string) $row[$startcol + 20] : null;
  1533. $this->moderation_status = ($row[$startcol + 21] !== null) ? (int) $row[$startcol + 21] : null;
  1534. $this->moderation_count = ($row[$startcol + 22] !== null) ? (int) $row[$startcol + 22] : null;
  1535. $this->modified_at = ($row[$startcol + 23] !== null) ? (string) $row[$startcol + 23] : null;
  1536. $this->access_control_id = ($row[$startcol + 24] !== null) ? (int) $row[$startcol + 24] : null;
  1537. $this->categories = ($row[$startcol + 25] !== null) ? (string) $row[$startcol + 25] : null;
  1538. $this->start_date = ($row[$startcol + 26] !== null) ? (string) $row[$startcol + 26] : null;
  1539. $this->end_date = ($row[$startcol + 27] !== null) ? (string) $row[$startcol + 27] : null;
  1540. $this->flavor_params = ($row[$startcol + 28] !== null) ? (string) $row[$startcol + 28] : null;
  1541. $this->available_from = ($row[$startcol + 29] !== null) ? (string) $row[$startcol + 29] : null;
  1542. $this->plugin_data = ($row[$startcol + 30] !== null) ? (string) $row[$startcol + 30] : null;
  1543. $this->resetModified();
  1544. $this->setNew(false);
  1545. if ($rehydrate) {
  1546. $this->ensureConsistency();
  1547. }
  1548. // FIXME - using NUM_COLUMNS may be clearer.
  1549. return $startcol + 31; // 31 = SearchEntryPeer::NUM_COLUMNS - SearchEntryPeer::NUM_LAZY_LOAD_COLUMNS).
  1550. } catch (Exception $e) {
  1551. throw new PropelException("Error populating SearchEntry object", $e);
  1552. }
  1553. }
  1554. /**
  1555. * Checks and repairs the internal consistency of the object.
  1556. *
  1557. * This method is executed after an already-instantiated object is re-hydrated
  1558. * from the database. It exists to check any foreign keys to make sure that
  1559. * the objects related to the current object are correct based on foreign key.
  1560. *
  1561. * You can override this method in the stub class, but you should always invoke
  1562. * the base method from the overridden method (i.e. parent::ensureConsistency()),
  1563. * in case your model changes.
  1564. *
  1565. * @throws PropelException
  1566. */
  1567. public function ensureConsistency()
  1568. {
  1569. } // ensureConsistency
  1570. /**
  1571. * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
  1572. *
  1573. * This will only work if the object has been saved and has a valid primary key set.
  1574. *
  1575. * @param boolean $deep (optional) Whether to also de-associated any related objects.
  1576. * @param PropelPDO $con (optional) The PropelPDO connection to use.
  1577. * @return void
  1578. * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
  1579. */
  1580. public function reload($deep = false, PropelPDO $con = null)
  1581. {
  1582. if ($this->isDeleted()) {
  1583. throw new PropelException("Cannot reload a deleted object.");
  1584. }
  1585. if ($this->isNew()) {
  1586. throw new PropelException("Cannot reload an unsaved object.");
  1587. }
  1588. if ($con === null) {
  1589. $con = Propel::getConnection(SearchEntryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  1590. }
  1591. // We don't need to alter the object instance pool; we're just modifying this instance
  1592. // already in the pool.
  1593. SearchEntryPeer::setUseCriteriaFilter(false);
  1594. $stmt = SearchEntryPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
  1595. SearchEntryPeer::setUseCriteriaFilter(true);
  1596. $row = $stmt->fetch(PDO::FETCH_NUM);
  1597. $stmt->closeCursor();
  1598. if (!$row) {
  1599. throw new PropelException('Cannot find matching row in the database to reload object values.');
  1600. }
  1601. $this->hydrate($row, 0, true); // rehydrate
  1602. if ($deep) { // also de-associate any related objects?
  1603. } // if (deep)
  1604. }
  1605. /**
  1606. * Removes this object from datastore and sets delete attribute.
  1607. *
  1608. * @param PropelPDO $con
  1609. * @return void
  1610. * @throws PropelException
  1611. * @see BaseObject::setDeleted()
  1612. * @see BaseObject::isDeleted()
  1613. */
  1614. public function delete(PropelPDO $con = null)
  1615. {
  1616. if ($this->isDeleted()) {
  1617. throw new PropelException("This object has already been deleted.");
  1618. }
  1619. if ($con === null) {
  1620. $con = Propel::getConnection(SearchEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  1621. }
  1622. $con->beginTransaction();
  1623. try {
  1624. $ret = $this->preDelete($con);
  1625. if ($ret) {
  1626. SearchEntryPeer::doDelete($this, $con);
  1627. $this->postDelete($con);
  1628. $this->setDeleted(true);
  1629. $con->commit();
  1630. } else {
  1631. $con->commit();
  1632. }
  1633. } catch (PropelException $e) {
  1634. $con->rollBack();
  1635. throw $e;
  1636. }
  1637. }
  1638. /**
  1639. * Persists this object to the database.
  1640. *
  1641. * If the object is new, it inserts it; otherwise an update is performed.
  1642. * All modified related objects will also be persisted in the doSave()
  1643. * method. This method wraps all precipitate database operations in a
  1644. * single transaction.
  1645. *
  1646. * @param PropelPDO $con
  1647. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  1648. * @throws PropelException
  1649. * @see doSave()
  1650. */
  1651. public function save(PropelPDO $con = null)
  1652. {
  1653. if ($this->isDeleted()) {
  1654. throw new PropelException("You cannot save an object that has been deleted.");
  1655. }
  1656. if ($con === null) {
  1657. $con = Propel::getConnection(SearchEntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  1658. }
  1659. $con->beginTransaction();
  1660. $isInsert = $this->isNew();
  1661. try {
  1662. $ret = $this->preSave($con);
  1663. if ($isInsert) {
  1664. $ret = $ret && $this->preInsert($con);
  1665. } else {
  1666. $ret = $ret && $this->preUpdate($con);
  1667. }
  1668. if ($ret) {
  1669. $affectedRows = $this->doSave($con);
  1670. if ($isInsert) {
  1671. $this->postInsert($con);
  1672. } else {
  1673. $this->postUpdate($con);
  1674. }
  1675. $this->postSave($con);
  1676. SearchEntryPeer::addInstanceToPool($this);
  1677. } else {
  1678. $affectedRows = 0;
  1679. }
  1680. $con->commit();
  1681. return $affectedRows;
  1682. } catch (PropelException $e) {
  1683. $con->rollBack();
  1684. throw $e;
  1685. }
  1686. }
  1687. /**
  1688. * Performs the work of inserting or updating the row in the database.
  1689. *
  1690. * If the object is new, it inserts it; otherwise an update is performed.
  1691. * All related objects are also updated in this method.
  1692. *
  1693. * @param PropelPDO $con
  1694. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  1695. * @throws PropelException
  1696. * @see save()
  1697. */
  1698. protected function doSave(PropelPDO $con)
  1699. {
  1700. $affectedRows = 0; // initialize var to track total num of affected rows
  1701. if (!$this->alreadyInSave) {
  1702. $this->alreadyInSave = true;
  1703. // If this object has been modified, then save it to the database.
  1704. if ($this->isModified()) {
  1705. if ($this->isNew()) {
  1706. $pk = SearchEntryPeer::doInsert($this, $con);
  1707. $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
  1708. // should always be true here (even though technically
  1709. // BasePeer::doInsert() can insert multiple rows).
  1710. $this->setNew(false);
  1711. } else {
  1712. $affectedRows += SearchEntryPeer::doUpdate($this, $con);
  1713. }
  1714. $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
  1715. }
  1716. $this->alreadyInSave = false;
  1717. }
  1718. return $affectedRows;
  1719. } // doSave()
  1720. /**
  1721. * Override in order to use the query cache.
  1722. * Cache invalidation keys are used to determine when cached queries are valid.
  1723. * Before returning a query result from the cache, the time of the cached query
  1724. * is compared to the time saved in the invalidation key.
  1725. * A cached query will only be used if it's newer than the matching invalidation key.
  1726. *
  1727. * @return array Array of keys that will should be updated when this object is modified.
  1728. */
  1729. public function getCacheInvalidationKeys()
  1730. {
  1731. return array();
  1732. }
  1733. /**
  1734. * Code to be run before persisting the object
  1735. * @param PropelPDO $con
  1736. * @return bloolean
  1737. */
  1738. public function preSave(PropelPDO $con = null)
  1739. {
  1740. return parent::preSave($con);
  1741. }
  1742. /**
  1743. * Code to be run after persisting the object
  1744. * @param PropelPDO $con
  1745. */
  1746. public function postSave(PropelPDO $con = null)
  1747. {
  1748. $this->oldColumnsValues = array();
  1749. }
  1750. /**
  1751. * Code to be run before inserting to database
  1752. * @param PropelPDO $con
  1753. * @return boolean
  1754. */
  1755. public function preInsert(PropelPDO $con = null)
  1756. {
  1757. $this->setCreatedAt(time());
  1758. $this->setUpdatedAt(time());
  1759. return true;
  1760. }
  1761. /**
  1762. * Code to be run after inserting to database
  1763. * @param PropelPDO $con
  1764. */
  1765. public function postInsert(PropelPDO $con = null)
  1766. {
  1767. kQueryCache::invalidateQueryCache($this);
  1768. }
  1769. /**
  1770. * Code to be run after updating the object in database
  1771. * @param PropelPDO $con
  1772. */
  1773. public function postUpdate(PropelPDO $con = null)
  1774. {
  1775. if ($this->alreadyInSave)
  1776. {
  1777. return;
  1778. }
  1779. kQueryCache::invalidateQueryCache($this);
  1780. }
  1781. /**
  1782. * Array of ValidationFailed objects.
  1783. * @var array ValidationFailed[]
  1784. */
  1785. protected $validationFailures = array();
  1786. /**
  1787. * Gets any ValidationFailed objects that resulted from last call to validate().
  1788. *
  1789. *
  1790. * @return array ValidationFailed[]
  1791. * @see validate()
  1792. */
  1793. public function getValidationFailures()
  1794. {
  1795. return $this->validationFailures;
  1796. }
  1797. /**
  1798. * Validates the objects modified field values and all objects related to this table.
  1799. *
  1800. * If $columns is either a column name or an array of column names
  1801. * only those columns are validated.
  1802. *
  1803. * @param mixed $columns Column name or an array of column names.
  1804. * @return boolean Whether all columns pass validation.
  1805. * @see doValidate()
  1806. * @see getValidationFailures()
  1807. */
  1808. public function validate($columns = null)
  1809. {
  1810. $res = $this->doValidate($columns);
  1811. if ($res === true) {
  1812. $this->validationFailures = array();
  1813. return true;
  1814. } else {
  1815. $this->validationFailures = $res;
  1816. return false;
  1817. }
  1818. }
  1819. /**
  1820. * This function performs the validation work for complex object models.
  1821. *
  1822. * In addition to checking the current object, all related objects will
  1823. * also be validated. If all pass then <code>true</code> is returned; otherwise
  1824. * an aggreagated array of ValidationFailed objects will be returned.
  1825. *
  1826. * @param array $columns Array of column names to validate.
  1827. * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  1828. */
  1829. protected function doValidate($columns = null)
  1830. {
  1831. if (!$this->alreadyInValidation) {
  1832. $this->alreadyInValidation = true;
  1833. $retval = null;
  1834. $failureMap = array();
  1835. if (($retval = SearchEntryPeer::doValidate($this, $columns)) !== true) {
  1836. $failureMap = array_merge($failureMap, $retval);
  1837. }
  1838. $this->alreadyInValidation = false;
  1839. }
  1840. return (!empty($failureMap) ? $failureMap : true);
  1841. }
  1842. /**
  1843. * Retrieves a field from the object by name passed in as a string.
  1844. *
  1845. * @param string $name name
  1846. * @param string $type The type of fieldname the $name is of:
  1847. * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  1848. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  1849. * @return mixed Value of field.
  1850. */
  1851. public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
  1852. {
  1853. $pos = SearchEntryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  1854. $field = $this->getByPosition($pos);
  1855. return $field;
  1856. }
  1857. /**
  1858. * Retrieves a field from the object by Position as specified in the xml schema.
  1859. * Zero-based.
  1860. *
  1861. * @param int $pos position in xml schema
  1862. * @return mixed Value of field at $pos
  1863. */
  1864. public function getByPosition($pos)
  1865. {
  1866. switch($pos) {
  1867. case 0:
  1868. return $this->getEntryId();
  1869. break;
  1870. case 1:
  1871. return $this->getKuserId();
  1872. break;
  1873. case 2:
  1874. return $this->getName();
  1875. break;
  1876. case 3:
  1877. return $this->getType();
  1878. break;
  1879. case 4:
  1880. return $this->getMediaType();
  1881. break;
  1882. case 5:
  1883. return $this->getViews();
  1884. break;
  1885. case 6:
  1886. return $this->getRank();
  1887. break;
  1888. case 7:
  1889. return $this->getTags();
  1890. break;
  1891. case 8:
  1892. return $this->getEntryStatus();
  1893. break;
  1894. case 9:
  1895. return $this->getSourceLink();
  1896. break;
  1897. case 10:
  1898. return $this->getDuration();
  1899. break;
  1900. case 11:
  1901. return $this->getDurationType();
  1902. break;
  1903. case 12:
  1904. return $this->getCreatedAt();
  1905. break;
  1906. case 13:
  1907. return $this->getUpdatedAt();
  1908. break;
  1909. case 14:
  1910. return $this->getPartnerId();
  1911. break;
  1912. case 15:
  1913. return $this->getDisplayInSearch();
  1914. break;
  1915. case 16:
  1916. return $this->getGroupId();
  1917. break;
  1918. case 17:
  1919. return $this->getPlays();
  1920. break;
  1921. case 18:
  1922. return $this->getDescription();
  1923. break;
  1924. case 19:
  1925. return $this->getMediaDate();
  1926. break;
  1927. case 20:
  1928. return $this->getAdminTags();
  1929. break;
  1930. case 21:
  1931. return $this->getModerationStatus();
  1932. break;
  1933. case 22:
  1934. return $this->getModerationCount();
  1935. break;
  1936. case 23:
  1937. return $this->getModifiedAt();
  1938. break;
  1939. case 24:
  1940. return $this->getAccessControlId();
  1941. break;
  1942. case 25:
  1943. return $this->getCategories();
  1944. break;
  1945. case 26:
  1946. return $this->getStartDate();
  1947. break;
  1948. case 27:
  1949. return $this->getEndDate();
  1950. break;
  1951. case 28:
  1952. return $this->getFlavorParams();
  1953. break;
  1954. case 29:
  1955. return $this->getAvailableFrom();
  1956. break;
  1957. case 30:
  1958. return $this->getPluginData();
  1959. break;
  1960. default:
  1961. return null;
  1962. break;
  1963. } // switch()
  1964. }
  1965. /**
  1966. * Exports the object as an array.
  1967. *
  1968. * You can specify the key type of the array by passing one of the class
  1969. * type constants.
  1970. *
  1971. * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  1972. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME.
  1973. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  1974. * @return an associative array containing the field names (as keys) and field values
  1975. */
  1976. public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
  1977. {
  1978. $keys = SearchEntryPeer::getFieldNames($keyType);
  1979. $result = array(
  1980. $keys[0] => $this->getEntryId(),
  1981. $keys[1] => $this->getKuserId(),
  1982. $keys[2] => $this->getName(),
  1983. $keys[3] => $this->getType(),
  1984. $keys[4] => $this->getMediaType(),
  1985. $keys[5] => $this->getViews(),
  1986. $keys[6] => $this->getRank(),
  1987. $keys[7] => $this->getTags(),
  1988. $keys[8] => $this->getEntryStatus(),
  1989. $keys[9] => $this->getSourceLink(),
  1990. $keys[10] => $this->getDuration(),
  1991. $keys[11] => $this->getDurationType(),
  1992. $keys[12] => $this->getCreatedAt(),
  1993. $keys[13] => $this->getUpdatedAt(),
  1994. $keys[14] => $this->getPartnerId(),
  1995. $keys[15] => $this->getDisplayInSearch(),
  1996. $keys[16] => $this->getGroupId(),
  1997. $keys[17] => $this->getPlays(),
  1998. $keys[18] => $this->getDescription(),
  1999. $keys[19] => $this->getMediaDate(),
  2000. $keys[20] => $this->getAdminTags(),
  2001. $keys[21] => $this->getModerationStatus(),
  2002. $keys[22] => $this->getModerationCount(),
  2003. $keys[23] => $this->getModifiedAt(),
  2004. $keys[24] => $this->getAccessControlId(),
  2005. $keys[25] => $this->getCategories(),
  2006. $keys[26] => $this->getStartDate(),
  2007. $keys[27] => $this->getEndDate(),
  2008. $keys[28] => $this->getFlavorParams(),
  2009. $keys[29] => $this->getAvailableFrom(),
  2010. $keys[30] => $this->getPluginData(),
  2011. );
  2012. return $result;
  2013. }
  2014. /**
  2015. * Sets a field from the object by name passed in as a string.
  2016. *
  2017. * @param string $name peer name
  2018. * @param mixed $value field value
  2019. * @param string $type The type of fieldname the $name is of:
  2020. * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  2021. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  2022. * @return void
  2023. */
  2024. public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
  2025. {
  2026. $pos = SearchEntryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  2027. return $this->setByPosition($pos, $value);
  2028. }
  2029. /**
  2030. * Sets a field from the object by Position as specified in the xml schema.
  2031. * Zero-based.
  2032. *
  2033. * @param int $pos position in xml schema
  2034. * @param mixed $value field value
  2035. * @return void
  2036. */
  2037. public function setByPosition($pos, $value)
  2038. {
  2039. switch($pos) {
  2040. case 0:
  2041. $this->setEntryId($value);
  2042. break;
  2043. case 1:
  2044. $this->setKuserId($value);
  2045. break;
  2046. case 2:
  2047. $this->setName($value);
  2048. break;
  2049. case 3:
  2050. $this->setType($value);
  2051. break;
  2052. case 4:
  2053. $this->setMediaType($value);
  2054. break;
  2055. case 5:
  2056. $this->setViews($value);
  2057. break;
  2058. case 6:
  2059. $this->setRank($value);
  2060. break;
  2061. case 7:
  2062. $this->setTags($value);
  2063. break;
  2064. case 8:
  2065. $this->setEntryStatus($value);
  2066. break;
  2067. case 9:
  2068. $this->setSourceLink($value);
  2069. break;
  2070. case 10:
  2071. $this->setDuration($value);
  2072. break;
  2073. case 11:
  2074. $this->setDurationType($value);
  2075. break;
  2076. case 12:
  2077. $this->setCreatedAt($value);
  2078. break;
  2079. case 13:
  2080. $this->setUpdatedAt($value);
  2081. break;
  2082. case 14:
  2083. $this->setPartnerId($value);
  2084. break;
  2085. case 15:
  2086. $this->setDisplayInSearch($value);
  2087. break;
  2088. case 16:
  2089. $this->setGroupId($value);
  2090. break;
  2091. case 17:
  2092. $this->setPlays($value);
  2093. break;
  2094. case 18:
  2095. $this->setDescription($value);
  2096. break;
  2097. case 19:
  2098. $this->setMediaDate($value);
  2099. break;
  2100. case 20:
  2101. $this->setAdminTags($value);
  2102. break;
  2103. case 21:
  2104. $this->setModerationStatus($value);
  2105. break;
  2106. case 22:
  2107. $this->setModerationCount($value);
  2108. break;
  2109. case 23:
  2110. $this->setModifiedAt($value);
  2111. break;
  2112. case 24:
  2113. $this->setAccessControlId($value);
  2114. break;
  2115. case 25:
  2116. $this->setCategories($value);
  2117. break;
  2118. case 26:
  2119. $this->setStartDate($value);
  2120. break;
  2121. case 27:
  2122. $this->setEndDate($value);
  2123. break;
  2124. case 28:
  2125. $this->setFlavorParams($value);
  2126. break;
  2127. case 29:
  2128. $this->setAvailableFrom($value);
  2129. break;
  2130. case 30:
  2131. $this->setPluginData($value);
  2132. break;
  2133. } // switch()
  2134. }
  2135. /**
  2136. * Populates the object using an array.
  2137. *
  2138. * This is particularly useful when populating an object from one of the
  2139. * request arrays (e.g. $_POST). This method goes through the column
  2140. * names, checking to see whether a matching key exists in populated
  2141. * array. If so the setByName() method is called for that column.
  2142. *
  2143. * You can specify the key type of the array by additionally passing one
  2144. * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  2145. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  2146. * The default key type is the column's phpname (e.g. 'AuthorId')
  2147. *
  2148. * @param array $arr An array to populate the object from.
  2149. * @param string $keyType The type of keys the array uses.
  2150. * @return void
  2151. */
  2152. public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
  2153. {
  2154. $keys = SearchEntryPeer::getFieldNames($keyType);
  2155. if (array_key_exists($keys[0], $arr)) $this->setEntryId($arr[$keys[0]]);
  2156. if (array_key_exists($keys[1], $arr)) $this->setKuserId($arr[$keys[1]]);
  2157. if (array_key_exists($keys[2], $arr)) $this->setName($arr[$keys[2]]);
  2158. if (array_key_exists($keys[3], $arr)) $this->setType($arr[$keys[3]]);
  2159. if (array_key_exists($keys[4], $arr)) $this->setMediaType($arr[$keys[4]]);
  2160. if (array_key_exists($keys[5], $arr)) $this->setViews($arr[$keys[5]]);
  2161. if (array_key_exists($keys[6], $arr)) $this->setRank($arr[$keys[6]]);
  2162. if (array_key_exists($keys[7], $arr)) $this->setTags($arr[$keys[7]]);
  2163. if (array_key_exists($keys[8], $arr)) $this->setEntryStatus($arr[$keys[8]]);
  2164. if (array_key_exists($keys[9], $arr)) $this->setSourceLink($arr[$keys[9]]);
  2165. if (array_key_exists($keys[10], $arr)) $this->setDuration($arr[$keys[10]]);
  2166. if (array_key_exists($keys[11], $arr)) $this->setDurationType($arr[$keys[11]]);
  2167. if (array_key_exists($keys[12], $arr)) $this->setCreatedAt($arr[$keys[12]]);
  2168. if (array_key_exists($keys[13], $arr)) $this->setUpdatedAt($arr[$keys[13]]);
  2169. if (array_key_exists($keys[14], $arr)) $this->setPartnerId($arr[$keys[14]]);
  2170. if (array_key_exists($keys[15], $arr)) $this->setDisplayInSearch($arr[$keys[15]]);
  2171. if (array_key_exists($keys[16], $arr)) $this->setGroupId($arr[$keys[16]]);
  2172. if (array_key_exists($keys[17], $arr)) $this->setPlays($arr[$keys[17]]);
  2173. if (array_key_exists($keys[18], $arr)) $this->setDescription($arr[$keys[18]]);
  2174. if (array_key_exists($keys[19], $arr)) $this->setMediaDate($arr[$keys[19]]);
  2175. if (array_key_exists($keys[20], $arr)) $this->setAdminTags($arr[$keys[20]]);
  2176. if (array_key_exists($keys[21], $arr)) $this->setModerationStatus($arr[$keys[21]]);
  2177. if (array_key_exists($keys[22], $arr)) $this->setModerationCount($arr[$keys[22]]);
  2178. if (array_key_exists($keys[23], $arr)) $this->setModifiedAt($arr[$keys[23]]);
  2179. if (array_key_exists($keys[24], $arr)) $this->setAccessControlId($arr[$keys[24]]);
  2180. if (array_key_exists($keys[25], $arr)) $this->setCategories($arr[$keys[25]]);
  2181. if (array_key_exists($keys[26], $arr)) $this->setStartDate($arr[$keys[26]]);
  2182. if (array_key_exists($keys[27], $arr)) $this->setEndDate($arr[$keys[27]]);
  2183. if (array_key_exists($keys[28], $arr)) $this->setFlavorParams($arr[$keys[28]]);
  2184. if (array_key_exists($keys[29], $arr)) $this->setAvailableFrom($arr[$keys[29]]);
  2185. if (array_key_exists($keys[30], $arr)) $this->setPluginData($arr[$keys[30]]);
  2186. }
  2187. /**
  2188. * Build a Criteria object containing the values of all modified columns in this object.
  2189. *
  2190. * @return Criteria The Criteria object containing all modified values.
  2191. */
  2192. public function buildCriteria()
  2193. {
  2194. $criteria = new Criteria(SearchEntryPeer::DATABASE_NAME);
  2195. if ($this->isColumnModified(SearchEntryPeer::ENTRY_ID)) $criteria->add(SearchEntryPeer::ENTRY_ID, $this->entry_id);
  2196. if ($this->isColumnModified(SearchEntryPeer::KUSER_ID)) $criteria->add(SearchEntryPeer::KUSER_ID, $this->kuser_id);
  2197. if ($this->isColumnModified(SearchEntryPeer::NAME)) $criteria->add(SearchEntryPeer::NAME, $this->name);
  2198. if ($this->isColumnModified(SearchEntryPeer::TYPE)) $criteria->add(SearchEntryPeer::TYPE, $this->type);
  2199. if ($this->isColumnModified(SearchEntryPeer::MEDIA_TYPE)) $criteria->add(SearchEntryPeer::MEDIA_TYPE, $this->media_type);
  2200. if ($this->isColumnModified(SearchEntryPeer::VIEWS)) $criteria->add(SearchEntryPeer::VIEWS, $this->views);
  2201. if ($this->isColumnModified(SearchEntryPeer::RANK)) $criteria->add(SearchEntryPeer::RANK, $this->rank);
  2202. if ($this->isColumnModified(SearchEntryPeer::TAGS)) $criteria->add(SearchEntryPeer::TAGS, $this->tags);
  2203. if ($this->isColumnModified(SearchEntryPeer::ENTRY_STATUS)) $criteria->add(SearchEntryPeer::ENTRY_STATUS, $this->entry_status);
  2204. if ($this->isColumnModified(SearchEntryPeer::SOURCE_LINK)) $criteria->add(SearchEntryPeer::SOURCE_LINK, $this->source_link);
  2205. if ($this->isColumnModified(SearchEntryPeer::DURATION)) $criteria->add(SearchEntryPeer::DURATION, $this->duration);
  2206. if ($this->isColumnModified(SearchEntryPeer::DURATION_TYPE)) $criteria->add(SearchEntryPeer::DURATION_TYPE, $this->duration_type);
  2207. if ($this->isColumnModified(SearchEntryPeer::CREATED_AT)) $criteria->add(SearchEntryPeer::CREATED_AT, $this->created_at);
  2208. if ($this->isColumnModified(SearchEntryPeer::UPDATED_AT)) $criteria->add(SearchEntryPeer::UPDATED_AT, $this->updated_at);
  2209. if ($this->isColumnModified(SearchEntryPeer::PARTNER_ID)) $criteria->add(SearchEntryPeer::PARTNER_ID, $this->partner_id);
  2210. if ($this->isColumnModified(SearchEntryPeer::DISPLAY_IN_SEARCH)) $criteria->add(SearchEntryPeer::DISPLAY_IN_SEARCH, $this->display_in_search);
  2211. if ($this->isColumnModified(SearchEntryPeer::GROUP_ID)) $criteria->add(SearchEntryPeer::GROUP_ID, $this->group_id);
  2212. if ($this->isColumnModified(SearchEntryPeer::PLAYS)) $criteria->add(SearchEntryPeer::PLAYS, $this->plays);
  2213. if ($this->isColumnModified(SearchEntryPeer::DESCRIPTION)) $criteria->add(SearchEntryPeer::DESCRIPTION, $this->description);
  2214. if ($this->isColumnModified(SearchEntryPeer::MEDIA_DATE)) $criteria->add(SearchEntryPeer::MEDIA_DATE, $this->media_date);
  2215. if ($this->isColumnModified(SearchEntryPeer::ADMIN_TAGS)) $criteria->add(SearchEntryPeer::ADMIN_TAGS, $this->admin_tags);
  2216. if ($this->isColumnModified(SearchEntryPeer::MODERATION_STATUS)) $criteria->add(SearchEntryPeer::MODERATION_STATUS, $this->moderation_status);
  2217. if ($this->isColumnModified(SearchEntryPeer::MODERATION_COUNT)) $criteria->add(SearchEntryPeer::MODERATION_COUNT, $this->moderation_count);
  2218. if ($this->isColumnModified(SearchEntryPeer::MODIFIED_AT)) $criteria->add(SearchEntryPeer::MODIFIED_AT, $this->modified_at);
  2219. if ($this->isColumnModified(SearchEntryPeer::ACCESS_CONTROL_ID)) $criteria->add(SearchEntryPeer::ACCESS_CONTROL_ID, $this->access_control_id);
  2220. if ($this->isColumnModified(SearchEntryPeer::CATEGORIES)) $criteria->add(SearchEntryPeer::CATEGORIES, $this->categories);
  2221. if ($this->isColumnModified(SearchEntryPeer::START_DATE)) $criteria->add(SearchEntryPeer::START_DATE, $this->start_date);
  2222. if ($this->isColumnModified(SearchEntryPeer::END_DATE)) $criteria->add(SearchEntryPeer::END_DATE, $this->end_date);
  2223. if ($this->isColumnModified(SearchEntryPeer::FLAVOR_PARAMS)) $criteria->add(SearchEntryPeer::FLAVOR_PARAMS, $this->flavor_params);
  2224. if ($this->isColumnModified(SearchEntryPeer::AVAILABLE_FROM)) $criteria->add(SearchEntryPeer::AVAILABLE_FROM, $this->available_from);
  2225. if ($this->isColumnModified(SearchEntryPeer::PLUGIN_DATA)) $criteria->add(SearchEntryPeer::PLUGIN_DATA, $this->plugin_data);
  2226. return $criteria;
  2227. }
  2228. /**
  2229. * Builds a Criteria object containing the primary key for this object.
  2230. *
  2231. * Unlike buildCriteria() this method includes the primary key values regardless
  2232. * of whether or not they have been modified.
  2233. *
  2234. * @return Criteria The Criteria object containing value(s) for primary key(s).
  2235. */
  2236. public function buildPkeyCriteria()
  2237. {
  2238. $criteria = new Criteria(SearchEntryPeer::DATABASE_NAME);
  2239. $criteria->add(SearchEntryPeer::ENTRY_ID, $this->entry_id);
  2240. return $criteria;
  2241. }
  2242. /**
  2243. * Returns the primary key for this object (row).
  2244. * @return string
  2245. */
  2246. public function getPrimaryKey()
  2247. {
  2248. return $this->getEntryId();
  2249. }
  2250. /**
  2251. * Generic method to set the primary key (entry_id column).
  2252. *
  2253. * @param string $key Primary key.
  2254. * @return void
  2255. */
  2256. public function setPrimaryKey($key)
  2257. {
  2258. $this->setEntryId($key);
  2259. }
  2260. /**
  2261. * Sets contents of passed object to values from current object.
  2262. *
  2263. * If desired, this method can also make copies of all associated (fkey referrers)
  2264. * objects.
  2265. *
  2266. * @param object $copyObj An object of SearchEntry (or compatible) type.
  2267. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  2268. * @throws PropelException
  2269. */
  2270. public function copyInto($copyObj, $deepCopy = false)
  2271. {
  2272. $copyObj->setEntryId($this->entry_id);
  2273. $copyObj->setKuserId($this->kuser_id);
  2274. $copyObj->setName($this->name);
  2275. $copyObj->setType($this->type);
  2276. $copyObj->setMediaType($this->media_type);
  2277. $copyObj->setViews($this->views);
  2278. $copyObj->setRank($this->rank);
  2279. $copyObj->setTags($this->tags);
  2280. $copyObj->setEntryStatus($this->entry_status);
  2281. $copyObj->setSourceLink($this->source_link);
  2282. $copyObj->setDuration($this->duration);
  2283. $copyObj->setDurationType($this->duration_type);
  2284. $copyObj->setCreatedAt($this->created_at);
  2285. $copyObj->setUpdatedAt($this->updated_at);
  2286. $copyObj->setPartnerId($this->partner_id);
  2287. $copyObj->setDisplayInSearch($this->display_in_search);
  2288. $copyObj->setGroupId($this->group_id);
  2289. $copyObj->setPlays($this->plays);
  2290. $copyObj->setDescription($this->description);
  2291. $copyObj->setMediaDate($this->media_date);
  2292. $copyObj->setAdminTags($this->admin_tags);
  2293. $copyObj->setModerationStatus($this->moderation_status);
  2294. $copyObj->setModerationCount($this->moderation_count);
  2295. $copyObj->setModifiedAt($this->modified_at);
  2296. $copyObj->setAccessControlId($this->access_control_id);
  2297. $copyObj->setCategories($this->categories);
  2298. $copyObj->setStartDate($this->start_date);
  2299. $copyObj->setEndDate($this->end_date);
  2300. $copyObj->setFlavorParams($this->flavor_params);
  2301. $copyObj->setAvailableFrom($this->available_from);
  2302. $copyObj->setPluginData($this->plugin_data);
  2303. $copyObj->setNew(true);
  2304. }
  2305. /**
  2306. * Makes a copy of this object that will be inserted as a new row in table when saved.
  2307. * It creates a new object filling in the simple attributes, but skipping any primary
  2308. * keys that are defined for the table.
  2309. *
  2310. * If desired, this method can also make copies of all associated (fkey referrers)
  2311. * objects.
  2312. *
  2313. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  2314. * @return SearchEntry Clone of current object.
  2315. * @throws PropelException
  2316. */
  2317. public function copy($deepCopy = false)
  2318. {
  2319. // we use get_class(), because this might be a subclass
  2320. $clazz = get_class($this);
  2321. $copyObj = new $clazz();
  2322. $this->copyInto($copyObj, $deepCopy);
  2323. $copyObj->setCopiedFrom($this);
  2324. return $copyObj;
  2325. }
  2326. /**
  2327. * Stores the source object that this object copied from
  2328. *
  2329. * @var SearchEntry Clone of current object.
  2330. */
  2331. protected $copiedFrom = null;
  2332. /**
  2333. * Stores the source object that this object copied from
  2334. *
  2335. * @param SearchEntry $copiedFrom Clone of current object.
  2336. */
  2337. public function setCopiedFrom(SearchEntry $copiedFrom)
  2338. {
  2339. $this->copiedFrom = $copiedFrom;
  2340. }
  2341. /**
  2342. * Returns a peer instance associated with this om.
  2343. *
  2344. * Since Peer classes are not to have any instance attributes, this method returns the
  2345. * same instance for all member of this class. The method could therefore
  2346. * be static, but this would prevent one from overriding the behavior.
  2347. *
  2348. * @return SearchEntryPeer
  2349. */
  2350. public function getPeer()
  2351. {
  2352. if (self::$peer === null) {
  2353. self::$peer = new SearchEntryPeer();
  2354. }
  2355. return self::$peer;
  2356. }
  2357. /**
  2358. * Resets all collections of referencing foreign keys.
  2359. *
  2360. * This method is a user-space workaround for PHP's inability to garbage collect objects
  2361. * with circular references. This is currently necessary when using Propel in certain
  2362. * daemon or large-volumne/high-memory operations.
  2363. *
  2364. * @param boolean $deep Whether to also clear the references on all associated objects.
  2365. */
  2366. public function clearAllReferences($deep = false)
  2367. {
  2368. if ($deep) {
  2369. } // if ($deep)
  2370. }
  2371. } // BaseSearchEntry