BaseCcTrans.php 48 KB

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