BaseCcBlockcontents.php 41 KB

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