PageRenderTime 58ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

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

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

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