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

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

https://bitbucket.org/pandaos/kaltura
PHP | 3481 lines | 1856 code | 469 blank | 1156 comment | 350 complexity | e4ee6eb1ede6c91f64fa76835d27570f MD5 | raw file
Possible License(s): AGPL-3.0, GPL-3.0, BSD-3-Clause, LGPL-2.1, GPL-2.0, LGPL-3.0, JSON, MPL-2.0-no-copyleft-exception, Apache-2.0
  1. <?php
  2. /**
  3. * Base class that represents a row from the 'partner' table.
  4. *
  5. *
  6. *
  7. * @package Core
  8. * @subpackage model.om
  9. */
  10. abstract class BasePartner extends BaseObject implements Persistent {
  11. /**
  12. * The Peer class.
  13. * Instance provides a convenient way of calling static methods on a class
  14. * that calling code may not be able to identify.
  15. * @var PartnerPeer
  16. */
  17. protected static $peer;
  18. /**
  19. * The value for the id field.
  20. * @var int
  21. */
  22. protected $id;
  23. /**
  24. * The value for the partner_name field.
  25. * @var string
  26. */
  27. protected $partner_name;
  28. /**
  29. * The value for the partner_alias field.
  30. * @var string
  31. */
  32. protected $partner_alias;
  33. /**
  34. * The value for the url1 field.
  35. * @var string
  36. */
  37. protected $url1;
  38. /**
  39. * The value for the url2 field.
  40. * @var string
  41. */
  42. protected $url2;
  43. /**
  44. * The value for the secret field.
  45. * @var string
  46. */
  47. protected $secret;
  48. /**
  49. * The value for the admin_secret field.
  50. * @var string
  51. */
  52. protected $admin_secret;
  53. /**
  54. * The value for the max_number_of_hits_per_day field.
  55. * Note: this column has a database default value of: -1
  56. * @var int
  57. */
  58. protected $max_number_of_hits_per_day;
  59. /**
  60. * The value for the appear_in_search field.
  61. * Note: this column has a database default value of: 2
  62. * @var int
  63. */
  64. protected $appear_in_search;
  65. /**
  66. * The value for the debug_level field.
  67. * Note: this column has a database default value of: 0
  68. * @var int
  69. */
  70. protected $debug_level;
  71. /**
  72. * The value for the invalid_login_count field.
  73. * Note: this column has a database default value of: 0
  74. * @var int
  75. */
  76. protected $invalid_login_count;
  77. /**
  78. * The value for the created_at field.
  79. * @var string
  80. */
  81. protected $created_at;
  82. /**
  83. * The value for the updated_at field.
  84. * @var string
  85. */
  86. protected $updated_at;
  87. /**
  88. * The value for the anonymous_kuser_id field.
  89. * @var int
  90. */
  91. protected $anonymous_kuser_id;
  92. /**
  93. * The value for the ks_max_expiry_in_seconds field.
  94. * Note: this column has a database default value of: 86400
  95. * @var int
  96. */
  97. protected $ks_max_expiry_in_seconds;
  98. /**
  99. * The value for the create_user_on_demand field.
  100. * Note: this column has a database default value of: 1
  101. * @var int
  102. */
  103. protected $create_user_on_demand;
  104. /**
  105. * The value for the prefix field.
  106. * @var string
  107. */
  108. protected $prefix;
  109. /**
  110. * The value for the admin_name field.
  111. * @var string
  112. */
  113. protected $admin_name;
  114. /**
  115. * The value for the admin_email field.
  116. * @var string
  117. */
  118. protected $admin_email;
  119. /**
  120. * The value for the description field.
  121. * @var string
  122. */
  123. protected $description;
  124. /**
  125. * The value for the commercial_use field.
  126. * Note: this column has a database default value of: 0
  127. * @var int
  128. */
  129. protected $commercial_use;
  130. /**
  131. * The value for the moderate_content field.
  132. * Note: this column has a database default value of: 0
  133. * @var int
  134. */
  135. protected $moderate_content;
  136. /**
  137. * The value for the notify field.
  138. * Note: this column has a database default value of: 0
  139. * @var int
  140. */
  141. protected $notify;
  142. /**
  143. * The value for the custom_data field.
  144. * @var string
  145. */
  146. protected $custom_data;
  147. /**
  148. * The value for the service_config_id field.
  149. * @var string
  150. */
  151. protected $service_config_id;
  152. /**
  153. * The value for the status field.
  154. * Note: this column has a database default value of: 1
  155. * @var int
  156. */
  157. protected $status;
  158. /**
  159. * The value for the content_categories field.
  160. * @var string
  161. */
  162. protected $content_categories;
  163. /**
  164. * The value for the type field.
  165. * Note: this column has a database default value of: 1
  166. * @var int
  167. */
  168. protected $type;
  169. /**
  170. * The value for the phone field.
  171. * @var string
  172. */
  173. protected $phone;
  174. /**
  175. * The value for the describe_yourself field.
  176. * @var string
  177. */
  178. protected $describe_yourself;
  179. /**
  180. * The value for the adult_content field.
  181. * Note: this column has a database default value of: 0
  182. * @var int
  183. */
  184. protected $adult_content;
  185. /**
  186. * The value for the partner_package field.
  187. * Note: this column has a database default value of: 1
  188. * @var int
  189. */
  190. protected $partner_package;
  191. /**
  192. * The value for the usage_percent field.
  193. * Note: this column has a database default value of: 0
  194. * @var int
  195. */
  196. protected $usage_percent;
  197. /**
  198. * The value for the storage_usage field.
  199. * Note: this column has a database default value of: 0
  200. * @var int
  201. */
  202. protected $storage_usage;
  203. /**
  204. * The value for the eighty_percent_warning field.
  205. * @var int
  206. */
  207. protected $eighty_percent_warning;
  208. /**
  209. * The value for the usage_limit_warning field.
  210. * @var int
  211. */
  212. protected $usage_limit_warning;
  213. /**
  214. * The value for the monitor_usage field.
  215. * Note: this column has a database default value of: 1
  216. * @var int
  217. */
  218. protected $monitor_usage;
  219. /**
  220. * The value for the priority_group_id field.
  221. * @var int
  222. */
  223. protected $priority_group_id;
  224. /**
  225. * The value for the partner_group_type field.
  226. * Note: this column has a database default value of: 1
  227. * @var int
  228. */
  229. protected $partner_group_type;
  230. /**
  231. * The value for the partner_parent_id field.
  232. * @var int
  233. */
  234. protected $partner_parent_id;
  235. /**
  236. * The value for the kmc_version field.
  237. * Note: this column has a database default value of: '1'
  238. * @var string
  239. */
  240. protected $kmc_version;
  241. /**
  242. * @var kuser
  243. */
  244. protected $akuser;
  245. /**
  246. * @var array adminKuser[] Collection to store aggregation of adminKuser objects.
  247. */
  248. protected $colladminKusers;
  249. /**
  250. * @var Criteria The criteria used to select the current contents of colladminKusers.
  251. */
  252. private $lastadminKuserCriteria = null;
  253. /**
  254. * Flag to prevent endless save loop, if this object is referenced
  255. * by another object which falls in this transaction.
  256. * @var boolean
  257. */
  258. protected $alreadyInSave = false;
  259. /**
  260. * Flag to prevent endless validation loop, if this object is referenced
  261. * by another object which falls in this transaction.
  262. * @var boolean
  263. */
  264. protected $alreadyInValidation = false;
  265. /**
  266. * Store columns old values before the changes
  267. * @var array
  268. */
  269. protected $oldColumnsValues = array();
  270. /**
  271. * @return array
  272. */
  273. public function getColumnsOldValues()
  274. {
  275. return $this->oldColumnsValues;
  276. }
  277. /**
  278. * Applies default values to this object.
  279. * This method should be called from the object's constructor (or
  280. * equivalent initialization method).
  281. * @see __construct()
  282. */
  283. public function applyDefaultValues()
  284. {
  285. $this->max_number_of_hits_per_day = -1;
  286. $this->appear_in_search = 2;
  287. $this->debug_level = 0;
  288. $this->invalid_login_count = 0;
  289. $this->ks_max_expiry_in_seconds = 86400;
  290. $this->create_user_on_demand = 1;
  291. $this->commercial_use = 0;
  292. $this->moderate_content = 0;
  293. $this->notify = 0;
  294. $this->status = 1;
  295. $this->type = 1;
  296. $this->adult_content = 0;
  297. $this->partner_package = 1;
  298. $this->usage_percent = 0;
  299. $this->storage_usage = 0;
  300. $this->monitor_usage = 1;
  301. $this->partner_group_type = 1;
  302. $this->kmc_version = '1';
  303. }
  304. /**
  305. * Initializes internal state of BasePartner object.
  306. * @see applyDefaults()
  307. */
  308. public function __construct()
  309. {
  310. parent::__construct();
  311. $this->applyDefaultValues();
  312. }
  313. /**
  314. * Get the [id] column value.
  315. *
  316. * @return int
  317. */
  318. public function getId()
  319. {
  320. return $this->id;
  321. }
  322. /**
  323. * Get the [partner_name] column value.
  324. *
  325. * @return string
  326. */
  327. public function getPartnerName()
  328. {
  329. return $this->partner_name;
  330. }
  331. /**
  332. * Get the [partner_alias] column value.
  333. *
  334. * @return string
  335. */
  336. public function getPartnerAlias()
  337. {
  338. return $this->partner_alias;
  339. }
  340. /**
  341. * Get the [url1] column value.
  342. *
  343. * @return string
  344. */
  345. public function getUrl1()
  346. {
  347. return $this->url1;
  348. }
  349. /**
  350. * Get the [url2] column value.
  351. *
  352. * @return string
  353. */
  354. public function getUrl2()
  355. {
  356. return $this->url2;
  357. }
  358. /**
  359. * Get the [secret] column value.
  360. *
  361. * @return string
  362. */
  363. public function getSecret()
  364. {
  365. return $this->secret;
  366. }
  367. /**
  368. * Get the [admin_secret] column value.
  369. *
  370. * @return string
  371. */
  372. public function getAdminSecret()
  373. {
  374. return $this->admin_secret;
  375. }
  376. /**
  377. * Get the [max_number_of_hits_per_day] column value.
  378. *
  379. * @return int
  380. */
  381. public function getMaxNumberOfHitsPerDay()
  382. {
  383. return $this->max_number_of_hits_per_day;
  384. }
  385. /**
  386. * Get the [appear_in_search] column value.
  387. *
  388. * @return int
  389. */
  390. public function getAppearInSearch()
  391. {
  392. return $this->appear_in_search;
  393. }
  394. /**
  395. * Get the [debug_level] column value.
  396. *
  397. * @return int
  398. */
  399. public function getDebugLevel()
  400. {
  401. return $this->debug_level;
  402. }
  403. /**
  404. * Get the [invalid_login_count] column value.
  405. *
  406. * @return int
  407. */
  408. public function getInvalidLoginCount()
  409. {
  410. return $this->invalid_login_count;
  411. }
  412. /**
  413. * Get the [optionally formatted] temporal [created_at] column value.
  414. *
  415. * This accessor only only work with unix epoch dates. Consider enabling the propel.useDateTimeClass
  416. * option in order to avoid converstions to integers (which are limited in the dates they can express).
  417. *
  418. * @param string $format The date/time format string (either date()-style or strftime()-style).
  419. * If format is NULL, then the raw unix timestamp integer will be returned.
  420. * @return mixed Formatted date/time value as string or (integer) unix timestamp (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
  421. * @throws PropelException - if unable to parse/validate the date/time value.
  422. */
  423. public function getCreatedAt($format = 'Y-m-d H:i:s')
  424. {
  425. if ($this->created_at === null) {
  426. return null;
  427. }
  428. if ($this->created_at === '0000-00-00 00:00:00') {
  429. // while technically this is not a default value of NULL,
  430. // this seems to be closest in meaning.
  431. return null;
  432. } else {
  433. try {
  434. $dt = new DateTime($this->created_at);
  435. } catch (Exception $x) {
  436. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x);
  437. }
  438. }
  439. if ($format === null) {
  440. // We cast here to maintain BC in API; obviously we will lose data if we're dealing with pre-/post-epoch dates.
  441. return (int) $dt->format('U');
  442. } elseif (strpos($format, '%') !== false) {
  443. return strftime($format, $dt->format('U'));
  444. } else {
  445. return $dt->format($format);
  446. }
  447. }
  448. /**
  449. * Get the [optionally formatted] temporal [updated_at] column value.
  450. *
  451. * This accessor only only work with unix epoch dates. Consider enabling the propel.useDateTimeClass
  452. * option in order to avoid converstions to integers (which are limited in the dates they can express).
  453. *
  454. * @param string $format The date/time format string (either date()-style or strftime()-style).
  455. * If format is NULL, then the raw unix timestamp integer will be returned.
  456. * @return mixed Formatted date/time value as string or (integer) unix timestamp (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
  457. * @throws PropelException - if unable to parse/validate the date/time value.
  458. */
  459. public function getUpdatedAt($format = 'Y-m-d H:i:s')
  460. {
  461. if ($this->updated_at === null) {
  462. return null;
  463. }
  464. if ($this->updated_at === '0000-00-00 00:00:00') {
  465. // while technically this is not a default value of NULL,
  466. // this seems to be closest in meaning.
  467. return null;
  468. } else {
  469. try {
  470. $dt = new DateTime($this->updated_at);
  471. } catch (Exception $x) {
  472. throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x);
  473. }
  474. }
  475. if ($format === null) {
  476. // We cast here to maintain BC in API; obviously we will lose data if we're dealing with pre-/post-epoch dates.
  477. return (int) $dt->format('U');
  478. } elseif (strpos($format, '%') !== false) {
  479. return strftime($format, $dt->format('U'));
  480. } else {
  481. return $dt->format($format);
  482. }
  483. }
  484. /**
  485. * Get the [anonymous_kuser_id] column value.
  486. *
  487. * @return int
  488. */
  489. public function getAnonymousKuserId()
  490. {
  491. return $this->anonymous_kuser_id;
  492. }
  493. /**
  494. * Get the [ks_max_expiry_in_seconds] column value.
  495. *
  496. * @return int
  497. */
  498. public function getKsMaxExpiryInSeconds()
  499. {
  500. return $this->ks_max_expiry_in_seconds;
  501. }
  502. /**
  503. * Get the [create_user_on_demand] column value.
  504. *
  505. * @return int
  506. */
  507. public function getCreateUserOnDemand()
  508. {
  509. return $this->create_user_on_demand;
  510. }
  511. /**
  512. * Get the [prefix] column value.
  513. *
  514. * @return string
  515. */
  516. public function getPrefix()
  517. {
  518. return $this->prefix;
  519. }
  520. /**
  521. * Get the [admin_name] column value.
  522. *
  523. * @return string
  524. */
  525. public function getAdminName()
  526. {
  527. return $this->admin_name;
  528. }
  529. /**
  530. * Get the [admin_email] column value.
  531. *
  532. * @return string
  533. */
  534. public function getAdminEmail()
  535. {
  536. return $this->admin_email;
  537. }
  538. /**
  539. * Get the [description] column value.
  540. *
  541. * @return string
  542. */
  543. public function getDescription()
  544. {
  545. return $this->description;
  546. }
  547. /**
  548. * Get the [commercial_use] column value.
  549. *
  550. * @return int
  551. */
  552. public function getCommercialUse()
  553. {
  554. return $this->commercial_use;
  555. }
  556. /**
  557. * Get the [moderate_content] column value.
  558. *
  559. * @return int
  560. */
  561. public function getModerateContent()
  562. {
  563. return $this->moderate_content;
  564. }
  565. /**
  566. * Get the [notify] column value.
  567. *
  568. * @return int
  569. */
  570. public function getNotify()
  571. {
  572. return $this->notify;
  573. }
  574. /**
  575. * Get the [custom_data] column value.
  576. *
  577. * @return string
  578. */
  579. public function getCustomData()
  580. {
  581. return $this->custom_data;
  582. }
  583. /**
  584. * Get the [service_config_id] column value.
  585. *
  586. * @return string
  587. */
  588. public function getServiceConfigId()
  589. {
  590. return $this->service_config_id;
  591. }
  592. /**
  593. * Get the [status] column value.
  594. *
  595. * @return int
  596. */
  597. public function getStatus()
  598. {
  599. return $this->status;
  600. }
  601. /**
  602. * Get the [content_categories] column value.
  603. *
  604. * @return string
  605. */
  606. public function getContentCategories()
  607. {
  608. return $this->content_categories;
  609. }
  610. /**
  611. * Get the [type] column value.
  612. *
  613. * @return int
  614. */
  615. public function getType()
  616. {
  617. return $this->type;
  618. }
  619. /**
  620. * Get the [phone] column value.
  621. *
  622. * @return string
  623. */
  624. public function getPhone()
  625. {
  626. return $this->phone;
  627. }
  628. /**
  629. * Get the [describe_yourself] column value.
  630. *
  631. * @return string
  632. */
  633. public function getDescribeYourself()
  634. {
  635. return $this->describe_yourself;
  636. }
  637. /**
  638. * Get the [adult_content] column value.
  639. *
  640. * @return int
  641. */
  642. public function getAdultContent()
  643. {
  644. return $this->adult_content;
  645. }
  646. /**
  647. * Get the [partner_package] column value.
  648. *
  649. * @return int
  650. */
  651. public function getPartnerPackage()
  652. {
  653. return $this->partner_package;
  654. }
  655. /**
  656. * Get the [usage_percent] column value.
  657. *
  658. * @return int
  659. */
  660. public function getUsagePercent()
  661. {
  662. return $this->usage_percent;
  663. }
  664. /**
  665. * Get the [storage_usage] column value.
  666. *
  667. * @return int
  668. */
  669. public function getStorageUsage()
  670. {
  671. return $this->storage_usage;
  672. }
  673. /**
  674. * Get the [eighty_percent_warning] column value.
  675. *
  676. * @return int
  677. */
  678. public function getEightyPercentWarning()
  679. {
  680. return $this->eighty_percent_warning;
  681. }
  682. /**
  683. * Get the [usage_limit_warning] column value.
  684. *
  685. * @return int
  686. */
  687. public function getUsageLimitWarning()
  688. {
  689. return $this->usage_limit_warning;
  690. }
  691. /**
  692. * Get the [monitor_usage] column value.
  693. *
  694. * @return int
  695. */
  696. public function getMonitorUsage()
  697. {
  698. return $this->monitor_usage;
  699. }
  700. /**
  701. * Get the [priority_group_id] column value.
  702. *
  703. * @return int
  704. */
  705. public function getPriorityGroupId()
  706. {
  707. return $this->priority_group_id;
  708. }
  709. /**
  710. * Get the [partner_group_type] column value.
  711. *
  712. * @return int
  713. */
  714. public function getPartnerGroupType()
  715. {
  716. return $this->partner_group_type;
  717. }
  718. /**
  719. * Get the [partner_parent_id] column value.
  720. *
  721. * @return int
  722. */
  723. public function getPartnerParentId()
  724. {
  725. return $this->partner_parent_id;
  726. }
  727. /**
  728. * Get the [kmc_version] column value.
  729. *
  730. * @return string
  731. */
  732. public function getKmcVersion()
  733. {
  734. return $this->kmc_version;
  735. }
  736. /**
  737. * Set the value of [id] column.
  738. *
  739. * @param int $v new value
  740. * @return Partner The current object (for fluent API support)
  741. */
  742. public function setId($v)
  743. {
  744. if(!isset($this->oldColumnsValues[PartnerPeer::ID]))
  745. $this->oldColumnsValues[PartnerPeer::ID] = $this->id;
  746. if ($v !== null) {
  747. $v = (int) $v;
  748. }
  749. if ($this->id !== $v) {
  750. $this->id = $v;
  751. $this->modifiedColumns[] = PartnerPeer::ID;
  752. }
  753. return $this;
  754. } // setId()
  755. /**
  756. * Set the value of [partner_name] column.
  757. *
  758. * @param string $v new value
  759. * @return Partner The current object (for fluent API support)
  760. */
  761. public function setPartnerName($v)
  762. {
  763. if(!isset($this->oldColumnsValues[PartnerPeer::PARTNER_NAME]))
  764. $this->oldColumnsValues[PartnerPeer::PARTNER_NAME] = $this->partner_name;
  765. if ($v !== null) {
  766. $v = (string) $v;
  767. }
  768. if ($this->partner_name !== $v) {
  769. $this->partner_name = $v;
  770. $this->modifiedColumns[] = PartnerPeer::PARTNER_NAME;
  771. }
  772. return $this;
  773. } // setPartnerName()
  774. /**
  775. * Set the value of [partner_alias] column.
  776. *
  777. * @param string $v new value
  778. * @return Partner The current object (for fluent API support)
  779. */
  780. public function setPartnerAlias($v)
  781. {
  782. if(!isset($this->oldColumnsValues[PartnerPeer::PARTNER_ALIAS]))
  783. $this->oldColumnsValues[PartnerPeer::PARTNER_ALIAS] = $this->partner_alias;
  784. if ($v !== null) {
  785. $v = (string) $v;
  786. }
  787. if ($this->partner_alias !== $v) {
  788. $this->partner_alias = $v;
  789. $this->modifiedColumns[] = PartnerPeer::PARTNER_ALIAS;
  790. }
  791. return $this;
  792. } // setPartnerAlias()
  793. /**
  794. * Set the value of [url1] column.
  795. *
  796. * @param string $v new value
  797. * @return Partner The current object (for fluent API support)
  798. */
  799. public function setUrl1($v)
  800. {
  801. if(!isset($this->oldColumnsValues[PartnerPeer::URL1]))
  802. $this->oldColumnsValues[PartnerPeer::URL1] = $this->url1;
  803. if ($v !== null) {
  804. $v = (string) $v;
  805. }
  806. if ($this->url1 !== $v) {
  807. $this->url1 = $v;
  808. $this->modifiedColumns[] = PartnerPeer::URL1;
  809. }
  810. return $this;
  811. } // setUrl1()
  812. /**
  813. * Set the value of [url2] column.
  814. *
  815. * @param string $v new value
  816. * @return Partner The current object (for fluent API support)
  817. */
  818. public function setUrl2($v)
  819. {
  820. if(!isset($this->oldColumnsValues[PartnerPeer::URL2]))
  821. $this->oldColumnsValues[PartnerPeer::URL2] = $this->url2;
  822. if ($v !== null) {
  823. $v = (string) $v;
  824. }
  825. if ($this->url2 !== $v) {
  826. $this->url2 = $v;
  827. $this->modifiedColumns[] = PartnerPeer::URL2;
  828. }
  829. return $this;
  830. } // setUrl2()
  831. /**
  832. * Set the value of [secret] column.
  833. *
  834. * @param string $v new value
  835. * @return Partner The current object (for fluent API support)
  836. */
  837. public function setSecret($v)
  838. {
  839. if(!isset($this->oldColumnsValues[PartnerPeer::SECRET]))
  840. $this->oldColumnsValues[PartnerPeer::SECRET] = $this->secret;
  841. if ($v !== null) {
  842. $v = (string) $v;
  843. }
  844. if ($this->secret !== $v) {
  845. $this->secret = $v;
  846. $this->modifiedColumns[] = PartnerPeer::SECRET;
  847. }
  848. return $this;
  849. } // setSecret()
  850. /**
  851. * Set the value of [admin_secret] column.
  852. *
  853. * @param string $v new value
  854. * @return Partner The current object (for fluent API support)
  855. */
  856. public function setAdminSecret($v)
  857. {
  858. if(!isset($this->oldColumnsValues[PartnerPeer::ADMIN_SECRET]))
  859. $this->oldColumnsValues[PartnerPeer::ADMIN_SECRET] = $this->admin_secret;
  860. if ($v !== null) {
  861. $v = (string) $v;
  862. }
  863. if ($this->admin_secret !== $v) {
  864. $this->admin_secret = $v;
  865. $this->modifiedColumns[] = PartnerPeer::ADMIN_SECRET;
  866. }
  867. return $this;
  868. } // setAdminSecret()
  869. /**
  870. * Set the value of [max_number_of_hits_per_day] column.
  871. *
  872. * @param int $v new value
  873. * @return Partner The current object (for fluent API support)
  874. */
  875. public function setMaxNumberOfHitsPerDay($v)
  876. {
  877. if(!isset($this->oldColumnsValues[PartnerPeer::MAX_NUMBER_OF_HITS_PER_DAY]))
  878. $this->oldColumnsValues[PartnerPeer::MAX_NUMBER_OF_HITS_PER_DAY] = $this->max_number_of_hits_per_day;
  879. if ($v !== null) {
  880. $v = (int) $v;
  881. }
  882. if ($this->max_number_of_hits_per_day !== $v || $this->isNew()) {
  883. $this->max_number_of_hits_per_day = $v;
  884. $this->modifiedColumns[] = PartnerPeer::MAX_NUMBER_OF_HITS_PER_DAY;
  885. }
  886. return $this;
  887. } // setMaxNumberOfHitsPerDay()
  888. /**
  889. * Set the value of [appear_in_search] column.
  890. *
  891. * @param int $v new value
  892. * @return Partner The current object (for fluent API support)
  893. */
  894. public function setAppearInSearch($v)
  895. {
  896. if(!isset($this->oldColumnsValues[PartnerPeer::APPEAR_IN_SEARCH]))
  897. $this->oldColumnsValues[PartnerPeer::APPEAR_IN_SEARCH] = $this->appear_in_search;
  898. if ($v !== null) {
  899. $v = (int) $v;
  900. }
  901. if ($this->appear_in_search !== $v || $this->isNew()) {
  902. $this->appear_in_search = $v;
  903. $this->modifiedColumns[] = PartnerPeer::APPEAR_IN_SEARCH;
  904. }
  905. return $this;
  906. } // setAppearInSearch()
  907. /**
  908. * Set the value of [debug_level] column.
  909. *
  910. * @param int $v new value
  911. * @return Partner The current object (for fluent API support)
  912. */
  913. public function setDebugLevel($v)
  914. {
  915. if(!isset($this->oldColumnsValues[PartnerPeer::DEBUG_LEVEL]))
  916. $this->oldColumnsValues[PartnerPeer::DEBUG_LEVEL] = $this->debug_level;
  917. if ($v !== null) {
  918. $v = (int) $v;
  919. }
  920. if ($this->debug_level !== $v || $this->isNew()) {
  921. $this->debug_level = $v;
  922. $this->modifiedColumns[] = PartnerPeer::DEBUG_LEVEL;
  923. }
  924. return $this;
  925. } // setDebugLevel()
  926. /**
  927. * Set the value of [invalid_login_count] column.
  928. *
  929. * @param int $v new value
  930. * @return Partner The current object (for fluent API support)
  931. */
  932. public function setInvalidLoginCount($v)
  933. {
  934. if(!isset($this->oldColumnsValues[PartnerPeer::INVALID_LOGIN_COUNT]))
  935. $this->oldColumnsValues[PartnerPeer::INVALID_LOGIN_COUNT] = $this->invalid_login_count;
  936. if ($v !== null) {
  937. $v = (int) $v;
  938. }
  939. if ($this->invalid_login_count !== $v || $this->isNew()) {
  940. $this->invalid_login_count = $v;
  941. $this->modifiedColumns[] = PartnerPeer::INVALID_LOGIN_COUNT;
  942. }
  943. return $this;
  944. } // setInvalidLoginCount()
  945. /**
  946. * Sets the value of [created_at] column to a normalized version of the date/time value specified.
  947. *
  948. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  949. * be treated as NULL for temporal objects.
  950. * @return Partner The current object (for fluent API support)
  951. */
  952. public function setCreatedAt($v)
  953. {
  954. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  955. // -- which is unexpected, to say the least.
  956. if ($v === null || $v === '') {
  957. $dt = null;
  958. } elseif ($v instanceof DateTime) {
  959. $dt = $v;
  960. } else {
  961. // some string/numeric value passed; we normalize that so that we can
  962. // validate it.
  963. try {
  964. if (is_numeric($v)) { // if it's a unix timestamp
  965. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  966. // We have to explicitly specify and then change the time zone because of a
  967. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  968. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  969. } else {
  970. $dt = new DateTime($v);
  971. }
  972. } catch (Exception $x) {
  973. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  974. }
  975. }
  976. if ( $this->created_at !== null || $dt !== null ) {
  977. // (nested ifs are a little easier to read in this case)
  978. $currNorm = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
  979. $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null;
  980. if ( ($currNorm !== $newNorm) // normalized values don't match
  981. )
  982. {
  983. $this->created_at = ($dt ? $dt->format('Y-m-d H:i:s') : null);
  984. $this->modifiedColumns[] = PartnerPeer::CREATED_AT;
  985. }
  986. } // if either are not null
  987. return $this;
  988. } // setCreatedAt()
  989. /**
  990. * Sets the value of [updated_at] column to a normalized version of the date/time value specified.
  991. *
  992. * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
  993. * be treated as NULL for temporal objects.
  994. * @return Partner The current object (for fluent API support)
  995. */
  996. public function setUpdatedAt($v)
  997. {
  998. // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
  999. // -- which is unexpected, to say the least.
  1000. if ($v === null || $v === '') {
  1001. $dt = null;
  1002. } elseif ($v instanceof DateTime) {
  1003. $dt = $v;
  1004. } else {
  1005. // some string/numeric value passed; we normalize that so that we can
  1006. // validate it.
  1007. try {
  1008. if (is_numeric($v)) { // if it's a unix timestamp
  1009. $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
  1010. // We have to explicitly specify and then change the time zone because of a
  1011. // DateTime bug: http://bugs.php.net/bug.php?id=43003
  1012. $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
  1013. } else {
  1014. $dt = new DateTime($v);
  1015. }
  1016. } catch (Exception $x) {
  1017. throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
  1018. }
  1019. }
  1020. if ( $this->updated_at !== null || $dt !== null ) {
  1021. // (nested ifs are a little easier to read in this case)
  1022. $currNorm = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
  1023. $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null;
  1024. if ( ($currNorm !== $newNorm) // normalized values don't match
  1025. )
  1026. {
  1027. $this->updated_at = ($dt ? $dt->format('Y-m-d H:i:s') : null);
  1028. $this->modifiedColumns[] = PartnerPeer::UPDATED_AT;
  1029. }
  1030. } // if either are not null
  1031. return $this;
  1032. } // setUpdatedAt()
  1033. /**
  1034. * Set the value of [anonymous_kuser_id] column.
  1035. *
  1036. * @param int $v new value
  1037. * @return Partner The current object (for fluent API support)
  1038. */
  1039. public function setAnonymousKuserId($v)
  1040. {
  1041. if(!isset($this->oldColumnsValues[PartnerPeer::ANONYMOUS_KUSER_ID]))
  1042. $this->oldColumnsValues[PartnerPeer::ANONYMOUS_KUSER_ID] = $this->anonymous_kuser_id;
  1043. if ($v !== null) {
  1044. $v = (int) $v;
  1045. }
  1046. if ($this->anonymous_kuser_id !== $v) {
  1047. $this->anonymous_kuser_id = $v;
  1048. $this->modifiedColumns[] = PartnerPeer::ANONYMOUS_KUSER_ID;
  1049. }
  1050. if ($this->akuser !== null && $this->akuser->getId() !== $v) {
  1051. $this->akuser = null;
  1052. }
  1053. return $this;
  1054. } // setAnonymousKuserId()
  1055. /**
  1056. * Set the value of [ks_max_expiry_in_seconds] column.
  1057. *
  1058. * @param int $v new value
  1059. * @return Partner The current object (for fluent API support)
  1060. */
  1061. public function setKsMaxExpiryInSeconds($v)
  1062. {
  1063. if(!isset($this->oldColumnsValues[PartnerPeer::KS_MAX_EXPIRY_IN_SECONDS]))
  1064. $this->oldColumnsValues[PartnerPeer::KS_MAX_EXPIRY_IN_SECONDS] = $this->ks_max_expiry_in_seconds;
  1065. if ($v !== null) {
  1066. $v = (int) $v;
  1067. }
  1068. if ($this->ks_max_expiry_in_seconds !== $v || $this->isNew()) {
  1069. $this->ks_max_expiry_in_seconds = $v;
  1070. $this->modifiedColumns[] = PartnerPeer::KS_MAX_EXPIRY_IN_SECONDS;
  1071. }
  1072. return $this;
  1073. } // setKsMaxExpiryInSeconds()
  1074. /**
  1075. * Set the value of [create_user_on_demand] column.
  1076. *
  1077. * @param int $v new value
  1078. * @return Partner The current object (for fluent API support)
  1079. */
  1080. public function setCreateUserOnDemand($v)
  1081. {
  1082. if(!isset($this->oldColumnsValues[PartnerPeer::CREATE_USER_ON_DEMAND]))
  1083. $this->oldColumnsValues[PartnerPeer::CREATE_USER_ON_DEMAND] = $this->create_user_on_demand;
  1084. if ($v !== null) {
  1085. $v = (int) $v;
  1086. }
  1087. if ($this->create_user_on_demand !== $v || $this->isNew()) {
  1088. $this->create_user_on_demand = $v;
  1089. $this->modifiedColumns[] = PartnerPeer::CREATE_USER_ON_DEMAND;
  1090. }
  1091. return $this;
  1092. } // setCreateUserOnDemand()
  1093. /**
  1094. * Set the value of [prefix] column.
  1095. *
  1096. * @param string $v new value
  1097. * @return Partner The current object (for fluent API support)
  1098. */
  1099. public function setPrefix($v)
  1100. {
  1101. if(!isset($this->oldColumnsValues[PartnerPeer::PREFIX]))
  1102. $this->oldColumnsValues[PartnerPeer::PREFIX] = $this->prefix;
  1103. if ($v !== null) {
  1104. $v = (string) $v;
  1105. }
  1106. if ($this->prefix !== $v) {
  1107. $this->prefix = $v;
  1108. $this->modifiedColumns[] = PartnerPeer::PREFIX;
  1109. }
  1110. return $this;
  1111. } // setPrefix()
  1112. /**
  1113. * Set the value of [admin_name] column.
  1114. *
  1115. * @param string $v new value
  1116. * @return Partner The current object (for fluent API support)
  1117. */
  1118. public function setAdminName($v)
  1119. {
  1120. if(!isset($this->oldColumnsValues[PartnerPeer::ADMIN_NAME]))
  1121. $this->oldColumnsValues[PartnerPeer::ADMIN_NAME] = $this->admin_name;
  1122. if ($v !== null) {
  1123. $v = (string) $v;
  1124. }
  1125. if ($this->admin_name !== $v) {
  1126. $this->admin_name = $v;
  1127. $this->modifiedColumns[] = PartnerPeer::ADMIN_NAME;
  1128. }
  1129. return $this;
  1130. } // setAdminName()
  1131. /**
  1132. * Set the value of [admin_email] column.
  1133. *
  1134. * @param string $v new value
  1135. * @return Partner The current object (for fluent API support)
  1136. */
  1137. public function setAdminEmail($v)
  1138. {
  1139. if(!isset($this->oldColumnsValues[PartnerPeer::ADMIN_EMAIL]))
  1140. $this->oldColumnsValues[PartnerPeer::ADMIN_EMAIL] = $this->admin_email;
  1141. if ($v !== null) {
  1142. $v = (string) $v;
  1143. }
  1144. if ($this->admin_email !== $v) {
  1145. $this->admin_email = $v;
  1146. $this->modifiedColumns[] = PartnerPeer::ADMIN_EMAIL;
  1147. }
  1148. return $this;
  1149. } // setAdminEmail()
  1150. /**
  1151. * Set the value of [description] column.
  1152. *
  1153. * @param string $v new value
  1154. * @return Partner The current object (for fluent API support)
  1155. */
  1156. public function setDescription($v)
  1157. {
  1158. if(!isset($this->oldColumnsValues[PartnerPeer::DESCRIPTION]))
  1159. $this->oldColumnsValues[PartnerPeer::DESCRIPTION] = $this->description;
  1160. if ($v !== null) {
  1161. $v = (string) $v;
  1162. }
  1163. if ($this->description !== $v) {
  1164. $this->description = $v;
  1165. $this->modifiedColumns[] = PartnerPeer::DESCRIPTION;
  1166. }
  1167. return $this;
  1168. } // setDescription()
  1169. /**
  1170. * Set the value of [commercial_use] column.
  1171. *
  1172. * @param int $v new value
  1173. * @return Partner The current object (for fluent API support)
  1174. */
  1175. public function setCommercialUse($v)
  1176. {
  1177. if(!isset($this->oldColumnsValues[PartnerPeer::COMMERCIAL_USE]))
  1178. $this->oldColumnsValues[PartnerPeer::COMMERCIAL_USE] = $this->commercial_use;
  1179. if ($v !== null) {
  1180. $v = (int) $v;
  1181. }
  1182. if ($this->commercial_use !== $v || $this->isNew()) {
  1183. $this->commercial_use = $v;
  1184. $this->modifiedColumns[] = PartnerPeer::COMMERCIAL_USE;
  1185. }
  1186. return $this;
  1187. } // setCommercialUse()
  1188. /**
  1189. * Set the value of [moderate_content] column.
  1190. *
  1191. * @param int $v new value
  1192. * @return Partner The current object (for fluent API support)
  1193. */
  1194. public function setModerateContent($v)
  1195. {
  1196. if(!isset($this->oldColumnsValues[PartnerPeer::MODERATE_CONTENT]))
  1197. $this->oldColumnsValues[PartnerPeer::MODERATE_CONTENT] = $this->moderate_content;
  1198. if ($v !== null) {
  1199. $v = (int) $v;
  1200. }
  1201. if ($this->moderate_content !== $v || $this->isNew()) {
  1202. $this->moderate_content = $v;
  1203. $this->modifiedColumns[] = PartnerPeer::MODERATE_CONTENT;
  1204. }
  1205. return $this;
  1206. } // setModerateContent()
  1207. /**
  1208. * Set the value of [notify] column.
  1209. *
  1210. * @param int $v new value
  1211. * @return Partner The current object (for fluent API support)
  1212. */
  1213. public function setNotify($v)
  1214. {
  1215. if(!isset($this->oldColumnsValues[PartnerPeer::NOTIFY]))
  1216. $this->oldColumnsValues[PartnerPeer::NOTIFY] = $this->notify;
  1217. if ($v !== null) {
  1218. $v = (int) $v;
  1219. }
  1220. if ($this->notify !== $v || $this->isNew()) {
  1221. $this->notify = $v;
  1222. $this->modifiedColumns[] = PartnerPeer::NOTIFY;
  1223. }
  1224. return $this;
  1225. } // setNotify()
  1226. /**
  1227. * Set the value of [custom_data] column.
  1228. *
  1229. * @param string $v new value
  1230. * @return Partner The current object (for fluent API support)
  1231. */
  1232. public function setCustomData($v)
  1233. {
  1234. if ($v !== null) {
  1235. $v = (string) $v;
  1236. }
  1237. if ($this->custom_data !== $v) {
  1238. $this->custom_data = $v;
  1239. $this->modifiedColumns[] = PartnerPeer::CUSTOM_DATA;
  1240. }
  1241. return $this;
  1242. } // setCustomData()
  1243. /**
  1244. * Set the value of [service_config_id] column.
  1245. *
  1246. * @param string $v new value
  1247. * @return Partner The current object (for fluent API support)
  1248. */
  1249. public function setServiceConfigId($v)
  1250. {
  1251. if(!isset($this->oldColumnsValues[PartnerPeer::SERVICE_CONFIG_ID]))
  1252. $this->oldColumnsValues[PartnerPeer::SERVICE_CONFIG_ID] = $this->service_config_id;
  1253. if ($v !== null) {
  1254. $v = (string) $v;
  1255. }
  1256. if ($this->service_config_id !== $v) {
  1257. $this->service_config_id = $v;
  1258. $this->modifiedColumns[] = PartnerPeer::SERVICE_CONFIG_ID;
  1259. }
  1260. return $this;
  1261. } // setServiceConfigId()
  1262. /**
  1263. * Set the value of [status] column.
  1264. *
  1265. * @param int $v new value
  1266. * @return Partner The current object (for fluent API support)
  1267. */
  1268. public function setStatus($v)
  1269. {
  1270. if(!isset($this->oldColumnsValues[PartnerPeer::STATUS]))
  1271. $this->oldColumnsValues[PartnerPeer::STATUS] = $this->status;
  1272. if ($v !== null) {
  1273. $v = (int) $v;
  1274. }
  1275. if ($this->status !== $v || $this->isNew()) {
  1276. $this->status = $v;
  1277. $this->modifiedColumns[] = PartnerPeer::STATUS;
  1278. }
  1279. return $this;
  1280. } // setStatus()
  1281. /**
  1282. * Set the value of [content_categories] column.
  1283. *
  1284. * @param string $v new value
  1285. * @return Partner The current object (for fluent API support)
  1286. */
  1287. public function setContentCategories($v)
  1288. {
  1289. if(!isset($this->oldColumnsValues[PartnerPeer::CONTENT_CATEGORIES]))
  1290. $this->oldColumnsValues[PartnerPeer::CONTENT_CATEGORIES] = $this->content_categories;
  1291. if ($v !== null) {
  1292. $v = (string) $v;
  1293. }
  1294. if ($this->content_categories !== $v) {
  1295. $this->content_categories = $v;
  1296. $this->modifiedColumns[] = PartnerPeer::CONTENT_CATEGORIES;
  1297. }
  1298. return $this;
  1299. } // setContentCategories()
  1300. /**
  1301. * Set the value of [type] column.
  1302. *
  1303. * @param int $v new value
  1304. * @return Partner The current object (for fluent API support)
  1305. */
  1306. public function setType($v)
  1307. {
  1308. if(!isset($this->oldColumnsValues[PartnerPeer::TYPE]))
  1309. $this->oldColumnsValues[PartnerPeer::TYPE] = $this->type;
  1310. if ($v !== null) {
  1311. $v = (int) $v;
  1312. }
  1313. if ($this->type !== $v || $this->isNew()) {
  1314. $this->type = $v;
  1315. $this->modifiedColumns[] = PartnerPeer::TYPE;
  1316. }
  1317. return $this;
  1318. } // setType()
  1319. /**
  1320. * Set the value of [phone] column.
  1321. *
  1322. * @param string $v new value
  1323. * @return Partner The current object (for fluent API support)
  1324. */
  1325. public function setPhone($v)
  1326. {
  1327. if(!isset($this->oldColumnsValues[PartnerPeer::PHONE]))
  1328. $this->oldColumnsValues[PartnerPeer::PHONE] = $this->phone;
  1329. if ($v !== null) {
  1330. $v = (string) $v;
  1331. }
  1332. if ($this->phone !== $v) {
  1333. $this->phone = $v;
  1334. $this->modifiedColumns[] = PartnerPeer::PHONE;
  1335. }
  1336. return $this;
  1337. } // setPhone()
  1338. /**
  1339. * Set the value of [describe_yourself] column.
  1340. *
  1341. * @param string $v new value
  1342. * @return Partner The current object (for fluent API support)
  1343. */
  1344. public function setDescribeYourself($v)
  1345. {
  1346. if(!isset($this->oldColumnsValues[PartnerPeer::DESCRIBE_YOURSELF]))
  1347. $this->oldColumnsValues[PartnerPeer::DESCRIBE_YOURSELF] = $this->describe_yourself;
  1348. if ($v !== null) {
  1349. $v = (string) $v;
  1350. }
  1351. if ($this->describe_yourself !== $v) {
  1352. $this->describe_yourself = $v;
  1353. $this->modifiedColumns[] = PartnerPeer::DESCRIBE_YOURSELF;
  1354. }
  1355. return $this;
  1356. } // setDescribeYourself()
  1357. /**
  1358. * Set the value of [adult_content] column.
  1359. *
  1360. * @param int $v new value
  1361. * @return Partner The current object (for fluent API support)
  1362. */
  1363. public function setAdultContent($v)
  1364. {
  1365. if(!isset($this->oldColumnsValues[PartnerPeer::ADULT_CONTENT]))
  1366. $this->oldColumnsValues[PartnerPeer::ADULT_CONTENT] = $this->adult_content;
  1367. if ($v !== null) {
  1368. $v = (int) $v;
  1369. }
  1370. if ($this->adult_content !== $v || $this->isNew()) {
  1371. $this->adult_content = $v;
  1372. $this->modifiedColumns[] = PartnerPeer::ADULT_CONTENT;
  1373. }
  1374. return $this;
  1375. } // setAdultContent()
  1376. /**
  1377. * Set the value of [partner_package] column.
  1378. *
  1379. * @param int $v new value
  1380. * @return Partner The current object (for fluent API support)
  1381. */
  1382. public function setPartnerPackage($v)
  1383. {
  1384. if(!isset($this->oldColumnsValues[PartnerPeer::PARTNER_PACKAGE]))
  1385. $this->oldColumnsValues[PartnerPeer::PARTNER_PACKAGE] = $this->partner_package;
  1386. if ($v !== null) {
  1387. $v = (int) $v;
  1388. }
  1389. if ($this->partner_package !== $v || $this->isNew()) {
  1390. $this->partner_package = $v;
  1391. $this->modifiedColumns[] = PartnerPeer::PARTNER_PACKAGE;
  1392. }
  1393. return $this;
  1394. } // setPartnerPackage()
  1395. /**
  1396. * Set the value of [usage_percent] column.
  1397. *
  1398. * @param int $v new value
  1399. * @return Partner The current object (for fluent API support)
  1400. */
  1401. public function setUsagePercent($v)
  1402. {
  1403. if(!isset($this->oldColumnsValues[PartnerPeer::USAGE_PERCENT]))
  1404. $this->oldColumnsValues[PartnerPeer::USAGE_PERCENT] = $this->usage_percent;
  1405. if ($v !== null) {
  1406. $v = (int) $v;
  1407. }
  1408. if ($this->usage_percent !== $v || $this->isNew()) {
  1409. $this->usage_percent = $v;
  1410. $this->modifiedColumns[] = PartnerPeer::USAGE_PERCENT;
  1411. }
  1412. return $this;
  1413. } // setUsagePercent()
  1414. /**
  1415. * Set the value of [storage_usage] column.
  1416. *
  1417. * @param int $v new value
  1418. * @return Partner The current object (for fluent API support)
  1419. */
  1420. public function setStorageUsage($v)
  1421. {
  1422. if(!isset($this->oldColumnsValues[PartnerPeer::STORAGE_USAGE]))
  1423. $this->oldColumnsValues[PartnerPeer::STORAGE_USAGE] = $this->storage_usage;
  1424. if ($v !== null) {
  1425. $v = (int) $v;
  1426. }
  1427. if ($this->storage_usage !== $v || $this->isNew()) {
  1428. $this->storage_usage = $v;
  1429. $this->modifiedColumns[] = PartnerPeer::STORAGE_USAGE;
  1430. }
  1431. return $this;
  1432. } // setStorageUsage()
  1433. /**
  1434. * Set the value of [eighty_percent_warning] column.
  1435. *
  1436. * @param int $v new value
  1437. * @return Partner The current object (for fluent API support)
  1438. */
  1439. public function setEightyPercentWarning($v)
  1440. {
  1441. if(!isset($this->oldColumnsValues[PartnerPeer::EIGHTY_PERCENT_WARNING]))
  1442. $this->oldColumnsValues[PartnerPeer::EIGHTY_PERCENT_WARNING] = $this->eighty_percent_warning;
  1443. if ($v !== null) {
  1444. $v = (int) $v;
  1445. }
  1446. if ($this->eighty_percent_warning !== $v) {
  1447. $this->eighty_percent_warning = $v;
  1448. $this->modifiedColumns[] = PartnerPeer::EIGHTY_PERCENT_WARNING;
  1449. }
  1450. return $this;
  1451. } // setEightyPercentWarning()
  1452. /**
  1453. * Set the value of [usage_limit_warning] column.
  1454. *
  1455. * @param int $v new value
  1456. * @return Partner The current object (for fluent API support)
  1457. */
  1458. public function setUsageLimitWarning($v)
  1459. {
  1460. if(!isset($this->oldColumnsValues[PartnerPeer::USAGE_LIMIT_WARNING]))
  1461. $this->oldColumnsValues[PartnerPeer::USAGE_LIMIT_WARNING] = $this->usage_limit_warning;
  1462. if ($v !== null) {
  1463. $v = (int) $v;
  1464. }
  1465. if ($this->usage_limit_warning !== $v) {
  1466. $this->usage_limit_warning = $v;
  1467. $this->modifiedColumns[] = PartnerPeer::USAGE_LIMIT_WARNING;
  1468. }
  1469. return $this;
  1470. } // setUsageLimitWarning()
  1471. /**
  1472. * Set the value of [monitor_usage] column.
  1473. *
  1474. * @param int $v new value
  1475. * @return Partner The current object (for fluent API support)
  1476. */
  1477. public function setMonitorUsage($v)
  1478. {
  1479. if(!isset($this->oldColumnsValues[PartnerPeer::MONITOR_USAGE]))
  1480. $this->oldColumnsValues[PartnerPeer::MONITOR_USAGE] = $this->monitor_usage;
  1481. if ($v !== null) {
  1482. $v = (int) $v;
  1483. }
  1484. if ($this->monitor_usage !== $v || $this->isNew()) {
  1485. $this->monitor_usage = $v;
  1486. $this->modifiedColumns[] = PartnerPeer::MONITOR_USAGE;
  1487. }
  1488. return $this;
  1489. } // setMonitorUsage()
  1490. /**
  1491. * Set the value of [priority_group_id] column.
  1492. *
  1493. * @param int $v new value
  1494. * @return Partner The current object (for fluent API support)
  1495. */
  1496. public function setPriorityGroupId($v)
  1497. {
  1498. if(!isset($this->oldColumnsValues[PartnerPeer::PRIORITY_GROUP_ID]))
  1499. $this->oldColumnsValues[PartnerPeer::PRIORITY_GROUP_ID] = $this->priority_group_id;
  1500. if ($v !== null) {
  1501. $v = (int) $v;
  1502. }
  1503. if ($this->priority_group_id !== $v) {
  1504. $this->priority_group_id = $v;
  1505. $this->modifiedColumns[] = PartnerPeer::PRIORITY_GROUP_ID;
  1506. }
  1507. return $this;
  1508. } // setPriorityGroupId()
  1509. /**
  1510. * Set the value of [partner_group_type] column.
  1511. *
  1512. * @param int $v new value
  1513. * @return Partner The current object (for fluent API support)
  1514. */
  1515. public function setPartnerGroupType($v)
  1516. {
  1517. if(!isset($this->oldColumnsValues[PartnerPeer::PARTNER_GROUP_TYPE]))
  1518. $this->oldColumnsValues[PartnerPeer::PARTNER_GROUP_TYPE] = $this->partner_group_type;
  1519. if ($v !== null) {
  1520. $v = (int) $v;
  1521. }
  1522. if ($this->partner_group_type !== $v || $this->isNew()) {
  1523. $this->partner_group_type = $v;
  1524. $this->modifiedColumns[] = PartnerPeer::PARTNER_GROUP_TYPE;
  1525. }
  1526. return $this;
  1527. } // setPartnerGroupType()
  1528. /**
  1529. * Set the value of [partner_parent_id] column.
  1530. *
  1531. * @param int $v new value
  1532. * @return Partner The current object (for fluent API support)
  1533. */
  1534. public function setPartnerParentId($v)
  1535. {
  1536. if(!isset($this->oldColumnsValues[PartnerPeer::PARTNER_PARENT_ID]))
  1537. $this->oldColumnsValues[PartnerPeer::PARTNER_PARENT_ID] = $this->partner_parent_id;
  1538. if ($v !== null) {
  1539. $v = (int) $v;
  1540. }
  1541. if ($this->partner_parent_id !== $v) {
  1542. $this->partner_parent_id = $v;
  1543. $this->modifiedColumns[] = PartnerPeer::PARTNER_PARENT_ID;
  1544. }
  1545. return $this;
  1546. } // setPartnerParentId()
  1547. /**
  1548. * Set the value of [kmc_version] column.
  1549. *
  1550. * @param string $v new value
  1551. * @return Partner The current object (for fluent API support)
  1552. */
  1553. public function setKmcVersion($v)
  1554. {
  1555. if(!isset($this->oldColumnsValues[PartnerPeer::KMC_VERSION]))
  1556. $this->oldColumnsValues[PartnerPeer::KMC_VERSION] = $this->kmc_version;
  1557. if ($v !== null) {
  1558. $v = (string) $v;
  1559. }
  1560. if ($this->kmc_version !== $v || $this->isNew()) {
  1561. $this->kmc_version = $v;
  1562. $this->modifiedColumns[] = PartnerPeer::KMC_VERSION;
  1563. }
  1564. return $this;
  1565. } // setKmcVersion()
  1566. /**
  1567. * Indicates whether the columns in this object are only set to default values.
  1568. *
  1569. * This method can be used in conjunction with isModified() to indicate whether an object is both
  1570. * modified _and_ has some values set which are non-default.
  1571. *
  1572. * @return boolean Whether the columns in this object are only been set with default values.
  1573. */
  1574. public function hasOnlyDefaultValues()
  1575. {
  1576. if ($this->max_number_of_hits_per_day !== -1) {
  1577. return false;
  1578. }
  1579. if ($this->appear_in_search !== 2) {
  1580. return false;
  1581. }
  1582. if ($this->debug_level !== 0) {
  1583. return false;
  1584. }
  1585. if ($this->invalid_login_count !== 0) {
  1586. return false;
  1587. }
  1588. if ($this->ks_max_expiry_in_seconds !== 86400) {
  1589. return false;
  1590. }
  1591. if ($this->create_user_on_demand !== 1) {
  1592. return false;
  1593. }
  1594. if ($this->commercial_use !== 0) {
  1595. return false;
  1596. }
  1597. if ($this->moderate_content !== 0) {
  1598. return false;
  1599. }
  1600. if ($this->notify !== 0) {
  1601. return false;
  1602. }
  1603. if ($this->status !== 1) {
  1604. return false;
  1605. }
  1606. if ($this->type !== 1) {
  1607. return false;
  1608. }
  1609. if ($this->adult_content !== 0) {
  1610. return false;
  1611. }
  1612. if ($this->partner_package !== 1) {
  1613. return false;
  1614. }
  1615. if ($this->usage_percent !== 0) {
  1616. return false;
  1617. }
  1618. if ($this->storage_usage !== 0) {
  1619. return false;
  1620. }
  1621. if ($this->monitor_usage !== 1) {
  1622. return false;
  1623. }
  1624. if ($this->partner_group_type !== 1) {
  1625. return false;
  1626. }
  1627. if ($this->kmc_version !== '1') {
  1628. return false;
  1629. }
  1630. // otherwise, everything was equal, so return TRUE
  1631. return true;
  1632. } // hasOnlyDefaultValues()
  1633. /**
  1634. * Hydrates (populates) the object variables with values from the database resultset.
  1635. *
  1636. * An offset (0-based "start column") is specified so that objects can be hydrated
  1637. * with a subset of the columns in the resultset rows. This is needed, for example,
  1638. * for results of JOIN queries where the resultset row includes columns from two or
  1639. * more tables.
  1640. *
  1641. * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
  1642. * @param int $startcol 0-based offset column which indicates which restultset column to start with.
  1643. * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
  1644. * @return int next starting column
  1645. * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
  1646. */
  1647. public function hydrate($row, $startcol = 0, $rehydrate = false)
  1648. {
  1649. try {
  1650. $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
  1651. $this->partner_name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
  1652. $this->partner_alias = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
  1653. $this->url1 = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
  1654. $this->url2 = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
  1655. $this->secret = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
  1656. $this->admin_secret = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
  1657. $this->max_number_of_hits_per_day = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null;
  1658. $this->appear_in_search = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null;
  1659. $this->debug_level = ($row[$startcol + 9] !== null) ? (int) $row[$startcol + 9] : null;
  1660. $this->invalid_login_count = ($row[$startcol + 10] !== null) ? (int) $row[$startcol + 10] : null;
  1661. $this->created_at = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
  1662. $this->updated_at = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null;
  1663. $this->anonymous_kuser_id = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null;
  1664. $this->ks_max_expiry_in_seconds = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null;
  1665. $this->create_user_on_demand = ($row[$startcol + 15] !== null) ? (int) $row[$startcol + 15] : null;
  1666. $this->prefix = ($row[$startcol + 16] !== null) ? (string) $row[$startcol + 16] : null;
  1667. $this->admin_name = ($row[$startcol + 17] !== null) ? (string) $row[$startcol + 17] : null;
  1668. $this->admin_email = ($row[$startcol + 18] !== null) ? (string) $row[$startcol + 18] : null;
  1669. $this->description = ($row[$startcol + 19] !== null) ? (string) $row[$startcol + 19] : null;
  1670. $this->commercial_use = ($row[$startcol + 20] !== null) ? (int) $row[$startcol + 20] : null;
  1671. $this->moderate_content = ($row[$startcol + 21] !== null) ? (int) $row[$startcol + 21] : null;
  1672. $this->notify = ($row[$startcol + 22] !== null) ? (int) $row[$startcol + 22] : null;
  1673. $this->custom_data = ($row[$startcol + 23] !== null) ? (string) $row[$startcol + 23] : null;
  1674. $this->service_config_id = ($row[$startcol + 24] !== null) ? (string) $row[$startcol + 24] : null;
  1675. $this->status = ($row[$startcol + 25] !== null) ? (int) $row[$startcol + 25] : null;
  1676. $this->content_categories = ($row[$startcol + 26] !== null) ? (string) $row[$startcol + 26] : null;
  1677. $this->type = ($row[$startcol + 27] !== null) ? (int) $row[$startcol + 27] : null;
  1678. $this->phone = ($row[$startcol + 28] !== null) ? (string) $row[$startcol + 28] : null;
  1679. $this->describe_yourself = ($row[$startcol + 29] !== null) ? (string) $row[$startcol + 29] : null;
  1680. $this->adult_content = ($row[$startcol + 30] !== null) ? (int) $row[$startcol + 30] : null;
  1681. $this->partner_package = ($row[$startcol + 31] !== null) ? (int) $row[$startcol + 31] : null;
  1682. $this->usage_percent = ($row[$startcol + 32] !== null) ? (int) $row[$startcol + 32] : null;
  1683. $this->storage_usage = ($row[$startcol + 33] !== null) ? (int) $row[$startcol + 33] : null;
  1684. $this->eighty_percent_warning = ($row[$startcol + 34] !== null) ? (int) $row[$startcol + 34] : null;
  1685. $this->usage_limit_warning = ($row[$startcol + 35] !== null) ? (int) $row[$startcol + 35] : null;
  1686. $this->monitor_usage = ($row[$startcol + 36] !== null) ? (int) $row[$startcol + 36] : null;
  1687. $this->priority_group_id = ($row[$startcol + 37] !== null) ? (int) $row[$startcol + 37] : null;
  1688. $this->partner_group_type = ($row[$startcol + 38] !== null) ? (int) $row[$startcol + 38] : null;
  1689. $this->partner_parent_id = ($row[$startcol + 39] !== null) ? (int) $row[$startcol + 39] : null;
  1690. $this->kmc_version = ($row[$startcol + 40] !== null) ? (string) $row[$startcol + 40] : null;
  1691. $this->resetModified();
  1692. $this->setNew(false);
  1693. if ($rehydrate) {
  1694. $this->ensureConsistency();
  1695. }
  1696. // FIXME - using NUM_COLUMNS may be clearer.
  1697. return $startcol + 41; // 41 = PartnerPeer::NUM_COLUMNS - PartnerPeer::NUM_LAZY_LOAD_COLUMNS).
  1698. } catch (Exception $e) {
  1699. throw new PropelException("Error populating Partner object", $e);
  1700. }
  1701. }
  1702. /**
  1703. * Checks and repairs the internal consistency of the object.
  1704. *
  1705. * This method is executed after an already-instantiated object is re-hydrated
  1706. * from the database. It exists to check any foreign keys to make sure that
  1707. * the objects related to the current object are correct based on foreign key.
  1708. *
  1709. * You can override this method in the stub class, but you should always invoke
  1710. * the base method from the overridden method (i.e. parent::ensureConsistency()),
  1711. * in case your model changes.
  1712. *
  1713. * @throws PropelException
  1714. */
  1715. public function ensureConsistency()
  1716. {
  1717. if ($this->akuser !== null && $this->anonymous_kuser_id !== $this->akuser->getId()) {
  1718. $this->akuser = null;
  1719. }
  1720. } // ensureConsistency
  1721. /**
  1722. * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
  1723. *
  1724. * This will only work if the object has been saved and has a valid primary key set.
  1725. *
  1726. * @param boolean $deep (optional) Whether to also de-associated any related objects.
  1727. * @param PropelPDO $con (optional) The PropelPDO connection to use.
  1728. * @return void
  1729. * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
  1730. */
  1731. public function reload($deep = false, PropelPDO $con = null)
  1732. {
  1733. if ($this->isDeleted()) {
  1734. throw new PropelException("Cannot reload a deleted object.");
  1735. }
  1736. if ($this->isNew()) {
  1737. throw new PropelException("Cannot reload an unsaved object.");
  1738. }
  1739. if ($con === null) {
  1740. $con = Propel::getConnection(PartnerPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  1741. }
  1742. // We don't need to alter the object instance pool; we're just modifying this instance
  1743. // already in the pool.
  1744. PartnerPeer::setUseCriteriaFilter(false);
  1745. $stmt = PartnerPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
  1746. PartnerPeer::setUseCriteriaFilter(true);
  1747. $row = $stmt->fetch(PDO::FETCH_NUM);
  1748. $stmt->closeCursor();
  1749. if (!$row) {
  1750. throw new PropelException('Cannot find matching row in the database to reload object values.');
  1751. }
  1752. $this->hydrate($row, 0, true); // rehydrate
  1753. if ($deep) { // also de-associate any related objects?
  1754. $this->akuser = null;
  1755. $this->colladminKusers = null;
  1756. $this->lastadminKuserCriteria = null;
  1757. } // if (deep)
  1758. }
  1759. /**
  1760. * Removes this object from datastore and sets delete attribute.
  1761. *
  1762. * @param PropelPDO $con
  1763. * @return void
  1764. * @throws PropelException
  1765. * @see BaseObject::setDeleted()
  1766. * @see BaseObject::isDeleted()
  1767. */
  1768. public function delete(PropelPDO $con = null)
  1769. {
  1770. if ($this->isDeleted()) {
  1771. throw new PropelException("This object has already been deleted.");
  1772. }
  1773. if ($con === null) {
  1774. $con = Propel::getConnection(PartnerPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  1775. }
  1776. $con->beginTransaction();
  1777. try {
  1778. $ret = $this->preDelete($con);
  1779. if ($ret) {
  1780. PartnerPeer::doDelete($this, $con);
  1781. $this->postDelete($con);
  1782. $this->setDeleted(true);
  1783. $con->commit();
  1784. } else {
  1785. $con->commit();
  1786. }
  1787. } catch (PropelException $e) {
  1788. $con->rollBack();
  1789. throw $e;
  1790. }
  1791. }
  1792. /**
  1793. * Persists this object to the database.
  1794. *
  1795. * If the object is new, it inserts it; otherwise an update is performed.
  1796. * All modified related objects will also be persisted in the doSave()
  1797. * method. This method wraps all precipitate database operations in a
  1798. * single transaction.
  1799. *
  1800. * @param PropelPDO $con
  1801. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  1802. * @throws PropelException
  1803. * @see doSave()
  1804. */
  1805. public function save(PropelPDO $con = null)
  1806. {
  1807. if ($this->isDeleted()) {
  1808. throw new PropelException("You cannot save an object that has been deleted.");
  1809. }
  1810. if ($con === null) {
  1811. $con = Propel::getConnection(PartnerPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  1812. }
  1813. $con->beginTransaction();
  1814. $isInsert = $this->isNew();
  1815. try {
  1816. $ret = $this->preSave($con);
  1817. if ($isInsert) {
  1818. $ret = $ret && $this->preInsert($con);
  1819. } else {
  1820. $ret = $ret && $this->preUpdate($con);
  1821. }
  1822. if ($ret) {
  1823. $affectedRows = $this->doSave($con);
  1824. if ($isInsert) {
  1825. $this->postInsert($con);
  1826. } else {
  1827. $this->postUpdate($con);
  1828. }
  1829. $this->postSave($con);
  1830. PartnerPeer::addInstanceToPool($this);
  1831. } else {
  1832. $affectedRows = 0;
  1833. }
  1834. $con->commit();
  1835. return $affectedRows;
  1836. } catch (PropelException $e) {
  1837. $con->rollBack();
  1838. throw $e;
  1839. }
  1840. }
  1841. /**
  1842. * Performs the work of inserting or updating the row in the database.
  1843. *
  1844. * If the object is new, it inserts it; otherwise an update is performed.
  1845. * All related objects are also updated in this method.
  1846. *
  1847. * @param PropelPDO $con
  1848. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  1849. * @throws PropelException
  1850. * @see save()
  1851. */
  1852. protected function doSave(PropelPDO $con)
  1853. {
  1854. $affectedRows = 0; // initialize var to track total num of affected rows
  1855. if (!$this->alreadyInSave) {
  1856. $this->alreadyInSave = true;
  1857. // We call the save method on the following object(s) if they
  1858. // were passed to this object by their coresponding set
  1859. // method. This object relates to these object(s) by a
  1860. // foreign key reference.
  1861. if ($this->akuser !== null) {
  1862. if ($this->akuser->isModified() || $this->akuser->isNew()) {
  1863. $affectedRows += $this->akuser->save($con);
  1864. }
  1865. $this->setkuser($this->akuser);
  1866. }
  1867. if ($this->isNew() ) {
  1868. $this->modifiedColumns[] = PartnerPeer::ID;
  1869. }
  1870. // If this object has been modified, then save it to the database.
  1871. if ($this->isModified()) {
  1872. if ($this->isNew()) {
  1873. $pk = PartnerPeer::doInsert($this, $con);
  1874. $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
  1875. // should always be true here (even though technically
  1876. // BasePeer::doInsert() can insert multiple rows).
  1877. $this->setId($pk); //[IMV] update autoincrement primary key
  1878. $this->setNew(false);
  1879. } else {
  1880. $affectedRows += PartnerPeer::doUpdate($this, $con);
  1881. }
  1882. $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
  1883. }
  1884. if ($this->colladminKusers !== null) {
  1885. foreach ($this->colladminKusers as $referrerFK) {
  1886. if (!$referrerFK->isDeleted()) {
  1887. $affectedRows += $referrerFK->save($con);
  1888. }
  1889. }
  1890. }
  1891. $this->alreadyInSave = false;
  1892. }
  1893. return $affectedRows;
  1894. } // doSave()
  1895. /**
  1896. * Override in order to use the query cache.
  1897. * Cache invalidation keys are used to determine when cached queries are valid.
  1898. * Before returning a query result from the cache, the time of the cached query
  1899. * is compared to the time saved in the invalidation key.
  1900. * A cached query will only be used if it's newer than the matching invalidation key.
  1901. *
  1902. * @return array Array of keys that will should be updated when this object is modified.
  1903. */
  1904. public function getCacheInvalidationKeys()
  1905. {
  1906. return array();
  1907. }
  1908. /**
  1909. * Code to be run before persisting the object
  1910. * @param PropelPDO $con
  1911. * @return bloolean
  1912. */
  1913. public function preSave(PropelPDO $con = null)
  1914. {
  1915. $this->setCustomDataObj();
  1916. return parent::preSave($con);
  1917. }
  1918. /**
  1919. * Code to be run after persisting the object
  1920. * @param PropelPDO $con
  1921. */
  1922. public function postSave(PropelPDO $con = null)
  1923. {
  1924. $this->oldColumnsValues = array();
  1925. $this->oldCustomDataValues = array();
  1926. }
  1927. /**
  1928. * Code to be run before inserting to database
  1929. * @param PropelPDO $con
  1930. * @return boolean
  1931. */
  1932. public function preInsert(PropelPDO $con = null)
  1933. {
  1934. $this->setCreatedAt(time());
  1935. $this->setUpdatedAt(time());
  1936. return true;
  1937. }
  1938. /**
  1939. * Code to be run after inserting to database
  1940. * @param PropelPDO $con
  1941. */
  1942. public function postInsert(PropelPDO $con = null)
  1943. {
  1944. kQueryCache::invalidateQueryCache($this);
  1945. kEventsManager::raiseEvent(new kObjectCreatedEvent($this));
  1946. if($this->copiedFrom)
  1947. kEventsManager::raiseEvent(new kObjectCopiedEvent($this->copiedFrom, $this));
  1948. }
  1949. /**
  1950. * Code to be run after updating the object in database
  1951. * @param PropelPDO $con
  1952. */
  1953. public function postUpdate(PropelPDO $con = null)
  1954. {
  1955. if ($this->alreadyInSave)
  1956. {
  1957. return;
  1958. }
  1959. if($this->isModified())
  1960. {
  1961. kQueryCache::invalidateQueryCache($this);
  1962. kEventsManager::raiseEvent(new kObjectChangedEvent($this, $this->tempModifiedColumns));
  1963. }
  1964. $this->tempModifiedColumns = array();
  1965. }
  1966. /**
  1967. * Saves the modified columns temporarily while saving
  1968. * @var array
  1969. */
  1970. private $tempModifiedColumns = array();
  1971. /**
  1972. * Returns whether the object has been modified.
  1973. *
  1974. * @return boolean True if the object has been modified.
  1975. */
  1976. public function isModified()
  1977. {
  1978. if(!empty($this->tempModifiedColumns))
  1979. return true;
  1980. return !empty($this->modifiedColumns);
  1981. }
  1982. /**
  1983. * Has specified column been modified?
  1984. *
  1985. * @param string $col
  1986. * @return boolean True if $col has been modified.
  1987. */
  1988. public function isColumnModified($col)
  1989. {
  1990. if(in_array($col, $this->tempModifiedColumns))
  1991. return true;
  1992. return in_array($col, $this->modifiedColumns);
  1993. }
  1994. /**
  1995. * Code to be run before updating the object in database
  1996. * @param PropelPDO $con
  1997. * @return boolean
  1998. */
  1999. public function preUpdate(PropelPDO $con = null)
  2000. {
  2001. if ($this->alreadyInSave)
  2002. {
  2003. return true;
  2004. }
  2005. if($this->isModified())
  2006. $this->setUpdatedAt(time());
  2007. $this->tempModifiedColumns = $this->modifiedColumns;
  2008. return true;
  2009. }
  2010. /**
  2011. * Array of ValidationFailed objects.
  2012. * @var array ValidationFailed[]
  2013. */
  2014. protected $validationFailures = array();
  2015. /**
  2016. * Gets any ValidationFailed objects that resulted from last call to validate().
  2017. *
  2018. *
  2019. * @return array ValidationFailed[]
  2020. * @see validate()
  2021. */
  2022. public function getValidationFailures()
  2023. {
  2024. return $this->validationFailures;
  2025. }
  2026. /**
  2027. * Validates the objects modified field values and all objects related to this table.
  2028. *
  2029. * If $columns is either a column name or an array of column names
  2030. * only those columns are validated.
  2031. *
  2032. * @param mixed $columns Column name or an array of column names.
  2033. * @return boolean Whether all columns pass validation.
  2034. * @see doValidate()
  2035. * @see getValidationFailures()
  2036. */
  2037. public function validate($columns = null)
  2038. {
  2039. $res = $this->doValidate($columns);
  2040. if ($res === true) {
  2041. $this->validationFailures = array();
  2042. return true;
  2043. } else {
  2044. $this->validationFailures = $res;
  2045. return false;
  2046. }
  2047. }
  2048. /**
  2049. * This function performs the validation work for complex object models.
  2050. *
  2051. * In addition to checking the current object, all related objects will
  2052. * also be validated. If all pass then <code>true</code> is returned; otherwise
  2053. * an aggreagated array of ValidationFailed objects will be returned.
  2054. *
  2055. * @param array $columns Array of column names to validate.
  2056. * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  2057. */
  2058. protected function doValidate($columns = null)
  2059. {
  2060. if (!$this->alreadyInValidation) {
  2061. $this->alreadyInValidation = true;
  2062. $retval = null;
  2063. $failureMap = array();
  2064. // We call the validate method on the following object(s) if they
  2065. // were passed to this object by their coresponding set
  2066. // method. This object relates to these object(s) by a
  2067. // foreign key reference.
  2068. if ($this->akuser !== null) {
  2069. if (!$this->akuser->validate($columns)) {
  2070. $failureMap = array_merge($failureMap, $this->akuser->getValidationFailures());
  2071. }
  2072. }
  2073. if (($retval = PartnerPeer::doValidate($this, $columns)) !== true) {
  2074. $failureMap = array_merge($failureMap, $retval);
  2075. }
  2076. if ($this->colladminKusers !== null) {
  2077. foreach ($this->colladminKusers as $referrerFK) {
  2078. if (!$referrerFK->validate($columns)) {
  2079. $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
  2080. }
  2081. }
  2082. }
  2083. $this->alreadyInValidation = false;
  2084. }
  2085. return (!empty($failureMap) ? $failureMap : true);
  2086. }
  2087. /**
  2088. * Retrieves a field from the object by name passed in as a string.
  2089. *
  2090. * @param string $name name
  2091. * @param string $type The type of fieldname the $name is of:
  2092. * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  2093. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  2094. * @return mixed Value of field.
  2095. */
  2096. public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
  2097. {
  2098. $pos = PartnerPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  2099. $field = $this->getByPosition($pos);
  2100. return $field;
  2101. }
  2102. /**
  2103. * Retrieves a field from the object by Position as specified in the xml schema.
  2104. * Zero-based.
  2105. *
  2106. * @param int $pos position in xml schema
  2107. * @return mixed Value of field at $pos
  2108. */
  2109. public function getByPosition($pos)
  2110. {
  2111. switch($pos) {
  2112. case 0:
  2113. return $this->getId();
  2114. break;
  2115. case 1:
  2116. return $this->getPartnerName();
  2117. break;
  2118. case 2:
  2119. return $this->getPartnerAlias();
  2120. break;
  2121. case 3:
  2122. return $this->getUrl1();
  2123. break;
  2124. case 4:
  2125. return $this->getUrl2();
  2126. break;
  2127. case 5:
  2128. return $this->getSecret();
  2129. break;
  2130. case 6:
  2131. return $this->getAdminSecret();
  2132. break;
  2133. case 7:
  2134. return $this->getMaxNumberOfHitsPerDay();
  2135. break;
  2136. case 8:
  2137. return $this->getAppearInSearch();
  2138. break;
  2139. case 9:
  2140. return $this->getDebugLevel();
  2141. break;
  2142. case 10:
  2143. return $this->getInvalidLoginCount();
  2144. break;
  2145. case 11:
  2146. return $this->getCreatedAt();
  2147. break;
  2148. case 12:
  2149. return $this->getUpdatedAt();
  2150. break;
  2151. case 13:
  2152. return $this->getAnonymousKuserId();
  2153. break;
  2154. case 14:
  2155. return $this->getKsMaxExpiryInSeconds();
  2156. break;
  2157. case 15:
  2158. return $this->getCreateUserOnDemand();
  2159. break;
  2160. case 16:
  2161. return $this->getPrefix();
  2162. break;
  2163. case 17:
  2164. return $this->getAdminName();
  2165. break;
  2166. case 18:
  2167. return $this->getAdminEmail();
  2168. break;
  2169. case 19:
  2170. return $this->getDescription();
  2171. break;
  2172. case 20:
  2173. return $this->getCommercialUse();
  2174. break;
  2175. case 21:
  2176. return $this->getModerateContent();
  2177. break;
  2178. case 22:
  2179. return $this->getNotify();
  2180. break;
  2181. case 23:
  2182. return $this->getCustomData();
  2183. break;
  2184. case 24:
  2185. return $this->getServiceConfigId();
  2186. break;
  2187. case 25:
  2188. return $this->getStatus();
  2189. break;
  2190. case 26:
  2191. return $this->getContentCategories();
  2192. break;
  2193. case 27:
  2194. return $this->getType();
  2195. break;
  2196. case 28:
  2197. return $this->getPhone();
  2198. break;
  2199. case 29:
  2200. return $this->getDescribeYourself();
  2201. break;
  2202. case 30:
  2203. return $this->getAdultContent();
  2204. break;
  2205. case 31:
  2206. return $this->getPartnerPackage();
  2207. break;
  2208. case 32:
  2209. return $this->getUsagePercent();
  2210. break;
  2211. case 33:
  2212. return $this->getStorageUsage();
  2213. break;
  2214. case 34:
  2215. return $this->getEightyPercentWarning();
  2216. break;
  2217. case 35:
  2218. return $this->getUsageLimitWarning();
  2219. break;
  2220. case 36:
  2221. return $this->getMonitorUsage();
  2222. break;
  2223. case 37:
  2224. return $this->getPriorityGroupId();
  2225. break;
  2226. case 38:
  2227. return $this->getPartnerGroupType();
  2228. break;
  2229. case 39:
  2230. return $this->getPartnerParentId();
  2231. break;
  2232. case 40:
  2233. return $this->getKmcVersion();
  2234. break;
  2235. default:
  2236. return null;
  2237. break;
  2238. } // switch()
  2239. }
  2240. /**
  2241. * Exports the object as an array.
  2242. *
  2243. * You can specify the key type of the array by passing one of the class
  2244. * type constants.
  2245. *
  2246. * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  2247. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. Defaults to BasePeer::TYPE_PHPNAME.
  2248. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  2249. * @return an associative array containing the field names (as keys) and field values
  2250. */
  2251. public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
  2252. {
  2253. $keys = PartnerPeer::getFieldNames($keyType);
  2254. $result = array(
  2255. $keys[0] => $this->getId(),
  2256. $keys[1] => $this->getPartnerName(),
  2257. $keys[2] => $this->getPartnerAlias(),
  2258. $keys[3] => $this->getUrl1(),
  2259. $keys[4] => $this->getUrl2(),
  2260. $keys[5] => $this->getSecret(),
  2261. $keys[6] => $this->getAdminSecret(),
  2262. $keys[7] => $this->getMaxNumberOfHitsPerDay(),
  2263. $keys[8] => $this->getAppearInSearch(),
  2264. $keys[9] => $this->getDebugLevel(),
  2265. $keys[10] => $this->getInvalidLoginCount(),
  2266. $keys[11] => $this->getCreatedAt(),
  2267. $keys[12] => $this->getUpdatedAt(),
  2268. $keys[13] => $this->getAnonymousKuserId(),
  2269. $keys[14] => $this->getKsMaxExpiryInSeconds(),
  2270. $keys[15] => $this->getCreateUserOnDemand(),
  2271. $keys[16] => $this->getPrefix(),
  2272. $keys[17] => $this->getAdminName(),
  2273. $keys[18] => $this->getAdminEmail(),
  2274. $keys[19] => $this->getDescription(),
  2275. $keys[20] => $this->getCommercialUse(),
  2276. $keys[21] => $this->getModerateContent(),
  2277. $keys[22] => $this->getNotify(),
  2278. $keys[23] => $this->getCustomData(),
  2279. $keys[24] => $this->getServiceConfigId(),
  2280. $keys[25] => $this->getStatus(),
  2281. $keys[26] => $this->getContentCategories(),
  2282. $keys[27] => $this->getType(),
  2283. $keys[28] => $this->getPhone(),
  2284. $keys[29] => $this->getDescribeYourself(),
  2285. $keys[30] => $this->getAdultContent(),
  2286. $keys[31] => $this->getPartnerPackage(),
  2287. $keys[32] => $this->getUsagePercent(),
  2288. $keys[33] => $this->getStorageUsage(),
  2289. $keys[34] => $this->getEightyPercentWarning(),
  2290. $keys[35] => $this->getUsageLimitWarning(),
  2291. $keys[36] => $this->getMonitorUsage(),
  2292. $keys[37] => $this->getPriorityGroupId(),
  2293. $keys[38] => $this->getPartnerGroupType(),
  2294. $keys[39] => $this->getPartnerParentId(),
  2295. $keys[40] => $this->getKmcVersion(),
  2296. );
  2297. return $result;
  2298. }
  2299. /**
  2300. * Sets a field from the object by name passed in as a string.
  2301. *
  2302. * @param string $name peer name
  2303. * @param mixed $value field value
  2304. * @param string $type The type of fieldname the $name is of:
  2305. * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  2306. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  2307. * @return void
  2308. */
  2309. public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
  2310. {
  2311. $pos = PartnerPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  2312. return $this->setByPosition($pos, $value);
  2313. }
  2314. /**
  2315. * Sets a field from the object by Position as specified in the xml schema.
  2316. * Zero-based.
  2317. *
  2318. * @param int $pos position in xml schema
  2319. * @param mixed $value field value
  2320. * @return void
  2321. */
  2322. public function setByPosition($pos, $value)
  2323. {
  2324. switch($pos) {
  2325. case 0:
  2326. $this->setId($value);
  2327. break;
  2328. case 1:
  2329. $this->setPartnerName($value);
  2330. break;
  2331. case 2:
  2332. $this->setPartnerAlias($value);
  2333. break;
  2334. case 3:
  2335. $this->setUrl1($value);
  2336. break;
  2337. case 4:
  2338. $this->setUrl2($value);
  2339. break;
  2340. case 5:
  2341. $this->setSecret($value);
  2342. break;
  2343. case 6:
  2344. $this->setAdminSecret($value);
  2345. break;
  2346. case 7:
  2347. $this->setMaxNumberOfHitsPerDay($value);
  2348. break;
  2349. case 8:
  2350. $this->setAppearInSearch($value);
  2351. break;
  2352. case 9:
  2353. $this->setDebugLevel($value);
  2354. break;
  2355. case 10:
  2356. $this->setInvalidLoginCount($value);
  2357. break;
  2358. case 11:
  2359. $this->setCreatedAt($value);
  2360. break;
  2361. case 12:
  2362. $this->setUpdatedAt($value);
  2363. break;
  2364. case 13:
  2365. $this->setAnonymousKuserId($value);
  2366. break;
  2367. case 14:
  2368. $this->setKsMaxExpiryInSeconds($value);
  2369. break;
  2370. case 15:
  2371. $this->setCreateUserOnDemand($value);
  2372. break;
  2373. case 16:
  2374. $this->setPrefix($value);
  2375. break;
  2376. case 17:
  2377. $this->setAdminName($value);
  2378. break;
  2379. case 18:
  2380. $this->setAdminEmail($value);
  2381. break;
  2382. case 19:
  2383. $this->setDescription($value);
  2384. break;
  2385. case 20:
  2386. $this->setCommercialUse($value);
  2387. break;
  2388. case 21:
  2389. $this->setModerateContent($value);
  2390. break;
  2391. case 22:
  2392. $this->setNotify($value);
  2393. break;
  2394. case 23:
  2395. $this->setCustomData($value);
  2396. break;
  2397. case 24:
  2398. $this->setServiceConfigId($value);
  2399. break;
  2400. case 25:
  2401. $this->setStatus($value);
  2402. break;
  2403. case 26:
  2404. $this->setContentCategories($value);
  2405. break;
  2406. case 27:
  2407. $this->setType($value);
  2408. break;
  2409. case 28:
  2410. $this->setPhone($value);
  2411. break;
  2412. case 29:
  2413. $this->setDescribeYourself($value);
  2414. break;
  2415. case 30:
  2416. $this->setAdultContent($value);
  2417. break;
  2418. case 31:
  2419. $this->setPartnerPackage($value);
  2420. break;
  2421. case 32:
  2422. $this->setUsagePercent($value);
  2423. break;
  2424. case 33:
  2425. $this->setStorageUsage($value);
  2426. break;
  2427. case 34:
  2428. $this->setEightyPercentWarning($value);
  2429. break;
  2430. case 35:
  2431. $this->setUsageLimitWarning($value);
  2432. break;
  2433. case 36:
  2434. $this->setMonitorUsage($value);
  2435. break;
  2436. case 37:
  2437. $this->setPriorityGroupId($value);
  2438. break;
  2439. case 38:
  2440. $this->setPartnerGroupType($value);
  2441. break;
  2442. case 39:
  2443. $this->setPartnerParentId($value);
  2444. break;
  2445. case 40:
  2446. $this->setKmcVersion($value);
  2447. break;
  2448. } // switch()
  2449. }
  2450. /**
  2451. * Populates the object using an array.
  2452. *
  2453. * This is particularly useful when populating an object from one of the
  2454. * request arrays (e.g. $_POST). This method goes through the column
  2455. * names, checking to see whether a matching key exists in populated
  2456. * array. If so the setByName() method is called for that column.
  2457. *
  2458. * You can specify the key type of the array by additionally passing one
  2459. * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  2460. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  2461. * The default key type is the column's phpname (e.g. 'AuthorId')
  2462. *
  2463. * @param array $arr An array to populate the object from.
  2464. * @param string $keyType The type of keys the array uses.
  2465. * @return void
  2466. */
  2467. public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
  2468. {
  2469. $keys = PartnerPeer::getFieldNames($keyType);
  2470. if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
  2471. if (array_key_exists($keys[1], $arr)) $this->setPartnerName($arr[$keys[1]]);
  2472. if (array_key_exists($keys[2], $arr)) $this->setPartnerAlias($arr[$keys[2]]);
  2473. if (array_key_exists($keys[3], $arr)) $this->setUrl1($arr[$keys[3]]);
  2474. if (array_key_exists($keys[4], $arr)) $this->setUrl2($arr[$keys[4]]);
  2475. if (array_key_exists($keys[5], $arr)) $this->setSecret($arr[$keys[5]]);
  2476. if (array_key_exists($keys[6], $arr)) $this->setAdminSecret($arr[$keys[6]]);
  2477. if (array_key_exists($keys[7], $arr)) $this->setMaxNumberOfHitsPerDay($arr[$keys[7]]);
  2478. if (array_key_exists($keys[8], $arr)) $this->setAppearInSearch($arr[$keys[8]]);
  2479. if (array_key_exists($keys[9], $arr)) $this->setDebugLevel($arr[$keys[9]]);
  2480. if (array_key_exists($keys[10], $arr)) $this->setInvalidLoginCount($arr[$keys[10]]);
  2481. if (array_key_exists($keys[11], $arr)) $this->setCreatedAt($arr[$keys[11]]);
  2482. if (array_key_exists($keys[12], $arr)) $this->setUpdatedAt($arr[$keys[12]]);
  2483. if (array_key_exists($keys[13], $arr)) $this->setAnonymousKuserId($arr[$keys[13]]);
  2484. if (array_key_exists($keys[14], $arr)) $this->setKsMaxExpiryInSeconds($arr[$keys[14]]);
  2485. if (array_key_exists($keys[15], $arr)) $this->setCreateUserOnDemand($arr[$keys[15]]);
  2486. if (array_key_exists($keys[16], $arr)) $this->setPrefix($arr[$keys[16]]);
  2487. if (array_key_exists($keys[17], $arr)) $this->setAdminName($arr[$keys[17]]);
  2488. if (array_key_exists($keys[18], $arr)) $this->setAdminEmail($arr[$keys[18]]);
  2489. if (array_key_exists($keys[19], $arr)) $this->setDescription($arr[$keys[19]]);
  2490. if (array_key_exists($keys[20], $arr)) $this->setCommercialUse($arr[$keys[20]]);
  2491. if (array_key_exists($keys[21], $arr)) $this->setModerateContent($arr[$keys[21]]);
  2492. if (array_key_exists($keys[22], $arr)) $this->setNotify($arr[$keys[22]]);
  2493. if (array_key_exists($keys[23], $arr)) $this->setCustomData($arr[$keys[23]]);
  2494. if (array_key_exists($keys[24], $arr)) $this->setServiceConfigId($arr[$keys[24]]);
  2495. if (array_key_exists($keys[25], $arr)) $this->setStatus($arr[$keys[25]]);
  2496. if (array_key_exists($keys[26], $arr)) $this->setContentCategories($arr[$keys[26]]);
  2497. if (array_key_exists($keys[27], $arr)) $this->setType($arr[$keys[27]]);
  2498. if (array_key_exists($keys[28], $arr)) $this->setPhone($arr[$keys[28]]);
  2499. if (array_key_exists($keys[29], $arr)) $this->setDescribeYourself($arr[$keys[29]]);
  2500. if (array_key_exists($keys[30], $arr)) $this->setAdultContent($arr[$keys[30]]);
  2501. if (array_key_exists($keys[31], $arr)) $this->setPartnerPackage($arr[$keys[31]]);
  2502. if (array_key_exists($keys[32], $arr)) $this->setUsagePercent($arr[$keys[32]]);
  2503. if (array_key_exists($keys[33], $arr)) $this->setStorageUsage($arr[$keys[33]]);
  2504. if (array_key_exists($keys[34], $arr)) $this->setEightyPercentWarning($arr[$keys[34]]);
  2505. if (array_key_exists($keys[35], $arr)) $this->setUsageLimitWarning($arr[$keys[35]]);
  2506. if (array_key_exists($keys[36], $arr)) $this->setMonitorUsage($arr[$keys[36]]);
  2507. if (array_key_exists($keys[37], $arr)) $this->setPriorityGroupId($arr[$keys[37]]);
  2508. if (array_key_exists($keys[38], $arr)) $this->setPartnerGroupType($arr[$keys[38]]);
  2509. if (array_key_exists($keys[39], $arr)) $this->setPartnerParentId($arr[$keys[39]]);
  2510. if (array_key_exists($keys[40], $arr)) $this->setKmcVersion($arr[$keys[40]]);
  2511. }
  2512. /**
  2513. * Build a Criteria object containing the values of all modified columns in this object.
  2514. *
  2515. * @return Criteria The Criteria object containing all modified values.
  2516. */
  2517. public function buildCriteria()
  2518. {
  2519. $criteria = new Criteria(PartnerPeer::DATABASE_NAME);
  2520. if ($this->isColumnModified(PartnerPeer::ID)) $criteria->add(PartnerPeer::ID, $this->id);
  2521. if ($this->isColumnModified(PartnerPeer::PARTNER_NAME)) $criteria->add(PartnerPeer::PARTNER_NAME, $this->partner_name);
  2522. if ($this->isColumnModified(PartnerPeer::PARTNER_ALIAS)) $criteria->add(PartnerPeer::PARTNER_ALIAS, $this->partner_alias);
  2523. if ($this->isColumnModified(PartnerPeer::URL1)) $criteria->add(PartnerPeer::URL1, $this->url1);
  2524. if ($this->isColumnModified(PartnerPeer::URL2)) $criteria->add(PartnerPeer::URL2, $this->url2);
  2525. if ($this->isColumnModified(PartnerPeer::SECRET)) $criteria->add(PartnerPeer::SECRET, $this->secret);
  2526. if ($this->isColumnModified(PartnerPeer::ADMIN_SECRET)) $criteria->add(PartnerPeer::ADMIN_SECRET, $this->admin_secret);
  2527. if ($this->isColumnModified(PartnerPeer::MAX_NUMBER_OF_HITS_PER_DAY)) $criteria->add(PartnerPeer::MAX_NUMBER_OF_HITS_PER_DAY, $this->max_number_of_hits_per_day);
  2528. if ($this->isColumnModified(PartnerPeer::APPEAR_IN_SEARCH)) $criteria->add(PartnerPeer::APPEAR_IN_SEARCH, $this->appear_in_search);
  2529. if ($this->isColumnModified(PartnerPeer::DEBUG_LEVEL)) $criteria->add(PartnerPeer::DEBUG_LEVEL, $this->debug_level);
  2530. if ($this->isColumnModified(PartnerPeer::INVALID_LOGIN_COUNT)) $criteria->add(PartnerPeer::INVALID_LOGIN_COUNT, $this->invalid_login_count);
  2531. if ($this->isColumnModified(PartnerPeer::CREATED_AT)) $criteria->add(PartnerPeer::CREATED_AT, $this->created_at);
  2532. if ($this->isColumnModified(PartnerPeer::UPDATED_AT)) $criteria->add(PartnerPeer::UPDATED_AT, $this->updated_at);
  2533. if ($this->isColumnModified(PartnerPeer::ANONYMOUS_KUSER_ID)) $criteria->add(PartnerPeer::ANONYMOUS_KUSER_ID, $this->anonymous_kuser_id);
  2534. if ($this->isColumnModified(PartnerPeer::KS_MAX_EXPIRY_IN_SECONDS)) $criteria->add(PartnerPeer::KS_MAX_EXPIRY_IN_SECONDS, $this->ks_max_expiry_in_seconds);
  2535. if ($this->isColumnModified(PartnerPeer::CREATE_USER_ON_DEMAND)) $criteria->add(PartnerPeer::CREATE_USER_ON_DEMAND, $this->create_user_on_demand);
  2536. if ($this->isColumnModified(PartnerPeer::PREFIX)) $criteria->add(PartnerPeer::PREFIX, $this->prefix);
  2537. if ($this->isColumnModified(PartnerPeer::ADMIN_NAME)) $criteria->add(PartnerPeer::ADMIN_NAME, $this->admin_name);
  2538. if ($this->isColumnModified(PartnerPeer::ADMIN_EMAIL)) $criteria->add(PartnerPeer::ADMIN_EMAIL, $this->admin_email);
  2539. if ($this->isColumnModified(PartnerPeer::DESCRIPTION)) $criteria->add(PartnerPeer::DESCRIPTION, $this->description);
  2540. if ($this->isColumnModified(PartnerPeer::COMMERCIAL_USE)) $criteria->add(PartnerPeer::COMMERCIAL_USE, $this->commercial_use);
  2541. if ($this->isColumnModified(PartnerPeer::MODERATE_CONTENT)) $criteria->add(PartnerPeer::MODERATE_CONTENT, $this->moderate_content);
  2542. if ($this->isColumnModified(PartnerPeer::NOTIFY)) $criteria->add(PartnerPeer::NOTIFY, $this->notify);
  2543. if ($this->isColumnModified(PartnerPeer::CUSTOM_DATA)) $criteria->add(PartnerPeer::CUSTOM_DATA, $this->custom_data);
  2544. if ($this->isColumnModified(PartnerPeer::SERVICE_CONFIG_ID)) $criteria->add(PartnerPeer::SERVICE_CONFIG_ID, $this->service_config_id);
  2545. if ($this->isColumnModified(PartnerPeer::STATUS)) $criteria->add(PartnerPeer::STATUS, $this->status);
  2546. if ($this->isColumnModified(PartnerPeer::CONTENT_CATEGORIES)) $criteria->add(PartnerPeer::CONTENT_CATEGORIES, $this->content_categories);
  2547. if ($this->isColumnModified(PartnerPeer::TYPE)) $criteria->add(PartnerPeer::TYPE, $this->type);
  2548. if ($this->isColumnModified(PartnerPeer::PHONE)) $criteria->add(PartnerPeer::PHONE, $this->phone);
  2549. if ($this->isColumnModified(PartnerPeer::DESCRIBE_YOURSELF)) $criteria->add(PartnerPeer::DESCRIBE_YOURSELF, $this->describe_yourself);
  2550. if ($this->isColumnModified(PartnerPeer::ADULT_CONTENT)) $criteria->add(PartnerPeer::ADULT_CONTENT, $this->adult_content);
  2551. if ($this->isColumnModified(PartnerPeer::PARTNER_PACKAGE)) $criteria->add(PartnerPeer::PARTNER_PACKAGE, $this->partner_package);
  2552. if ($this->isColumnModified(PartnerPeer::USAGE_PERCENT)) $criteria->add(PartnerPeer::USAGE_PERCENT, $this->usage_percent);
  2553. if ($this->isColumnModified(PartnerPeer::STORAGE_USAGE)) $criteria->add(PartnerPeer::STORAGE_USAGE, $this->storage_usage);
  2554. if ($this->isColumnModified(PartnerPeer::EIGHTY_PERCENT_WARNING)) $criteria->add(PartnerPeer::EIGHTY_PERCENT_WARNING, $this->eighty_percent_warning);
  2555. if ($this->isColumnModified(PartnerPeer::USAGE_LIMIT_WARNING)) $criteria->add(PartnerPeer::USAGE_LIMIT_WARNING, $this->usage_limit_warning);
  2556. if ($this->isColumnModified(PartnerPeer::MONITOR_USAGE)) $criteria->add(PartnerPeer::MONITOR_USAGE, $this->monitor_usage);
  2557. if ($this->isColumnModified(PartnerPeer::PRIORITY_GROUP_ID)) $criteria->add(PartnerPeer::PRIORITY_GROUP_ID, $this->priority_group_id);
  2558. if ($this->isColumnModified(PartnerPeer::PARTNER_GROUP_TYPE)) $criteria->add(PartnerPeer::PARTNER_GROUP_TYPE, $this->partner_group_type);
  2559. if ($this->isColumnModified(PartnerPeer::PARTNER_PARENT_ID)) $criteria->add(PartnerPeer::PARTNER_PARENT_ID, $this->partner_parent_id);
  2560. if ($this->isColumnModified(PartnerPeer::KMC_VERSION)) $criteria->add(PartnerPeer::KMC_VERSION, $this->kmc_version);
  2561. return $criteria;
  2562. }
  2563. /**
  2564. * Builds a Criteria object containing the primary key for this object.
  2565. *
  2566. * Unlike buildCriteria() this method includes the primary key values regardless
  2567. * of whether or not they have been modified.
  2568. *
  2569. * @return Criteria The Criteria object containing value(s) for primary key(s).
  2570. */
  2571. public function buildPkeyCriteria()
  2572. {
  2573. $criteria = new Criteria(PartnerPeer::DATABASE_NAME);
  2574. $criteria->add(PartnerPeer::ID, $this->id);
  2575. return $criteria;
  2576. }
  2577. /**
  2578. * Returns the primary key for this object (row).
  2579. * @return int
  2580. */
  2581. public function getPrimaryKey()
  2582. {
  2583. return $this->getId();
  2584. }
  2585. /**
  2586. * Generic method to set the primary key (id column).
  2587. *
  2588. * @param int $key Primary key.
  2589. * @return void
  2590. */
  2591. public function setPrimaryKey($key)
  2592. {
  2593. $this->setId($key);
  2594. }
  2595. /**
  2596. * Sets contents of passed object to values from current object.
  2597. *
  2598. * If desired, this method can also make copies of all associated (fkey referrers)
  2599. * objects.
  2600. *
  2601. * @param object $copyObj An object of Partner (or compatible) type.
  2602. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  2603. * @throws PropelException
  2604. */
  2605. public function copyInto($copyObj, $deepCopy = false)
  2606. {
  2607. $copyObj->setPartnerName($this->partner_name);
  2608. $copyObj->setPartnerAlias($this->partner_alias);
  2609. $copyObj->setUrl1($this->url1);
  2610. $copyObj->setUrl2($this->url2);
  2611. $copyObj->setSecret($this->secret);
  2612. $copyObj->setAdminSecret($this->admin_secret);
  2613. $copyObj->setMaxNumberOfHitsPerDay($this->max_number_of_hits_per_day);
  2614. $copyObj->setAppearInSearch($this->appear_in_search);
  2615. $copyObj->setDebugLevel($this->debug_level);
  2616. $copyObj->setInvalidLoginCount($this->invalid_login_count);
  2617. $copyObj->setCreatedAt($this->created_at);
  2618. $copyObj->setUpdatedAt($this->updated_at);
  2619. $copyObj->setAnonymousKuserId($this->anonymous_kuser_id);
  2620. $copyObj->setKsMaxExpiryInSeconds($this->ks_max_expiry_in_seconds);
  2621. $copyObj->setCreateUserOnDemand($this->create_user_on_demand);
  2622. $copyObj->setPrefix($this->prefix);
  2623. $copyObj->setAdminName($this->admin_name);
  2624. $copyObj->setAdminEmail($this->admin_email);
  2625. $copyObj->setDescription($this->description);
  2626. $copyObj->setCommercialUse($this->commercial_use);
  2627. $copyObj->setModerateContent($this->moderate_content);
  2628. $copyObj->setNotify($this->notify);
  2629. $copyObj->setCustomData($this->custom_data);
  2630. $copyObj->setServiceConfigId($this->service_config_id);
  2631. $copyObj->setStatus($this->status);
  2632. $copyObj->setContentCategories($this->content_categories);
  2633. $copyObj->setType($this->type);
  2634. $copyObj->setPhone($this->phone);
  2635. $copyObj->setDescribeYourself($this->describe_yourself);
  2636. $copyObj->setAdultContent($this->adult_content);
  2637. $copyObj->setPartnerPackage($this->partner_package);
  2638. $copyObj->setUsagePercent($this->usage_percent);
  2639. $copyObj->setStorageUsage($this->storage_usage);
  2640. $copyObj->setEightyPercentWarning($this->eighty_percent_warning);
  2641. $copyObj->setUsageLimitWarning($this->usage_limit_warning);
  2642. $copyObj->setMonitorUsage($this->monitor_usage);
  2643. $copyObj->setPriorityGroupId($this->priority_group_id);
  2644. $copyObj->setPartnerGroupType($this->partner_group_type);
  2645. $copyObj->setPartnerParentId($this->partner_parent_id);
  2646. $copyObj->setKmcVersion($this->kmc_version);
  2647. if ($deepCopy) {
  2648. // important: temporarily setNew(false) because this affects the behavior of
  2649. // the getter/setter methods for fkey referrer objects.
  2650. $copyObj->setNew(false);
  2651. foreach ($this->getadminKusers() as $relObj) {
  2652. if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
  2653. $copyObj->addadminKuser($relObj->copy($deepCopy));
  2654. }
  2655. }
  2656. } // if ($deepCopy)
  2657. $copyObj->setNew(true);
  2658. $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
  2659. }
  2660. /**
  2661. * Makes a copy of this object that will be inserted as a new row in table when saved.
  2662. * It creates a new object filling in the simple attributes, but skipping any primary
  2663. * keys that are defined for the table.
  2664. *
  2665. * If desired, this method can also make copies of all associated (fkey referrers)
  2666. * objects.
  2667. *
  2668. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  2669. * @return Partner Clone of current object.
  2670. * @throws PropelException
  2671. */
  2672. public function copy($deepCopy = false)
  2673. {
  2674. // we use get_class(), because this might be a subclass
  2675. $clazz = get_class($this);
  2676. $copyObj = new $clazz();
  2677. $this->copyInto($copyObj, $deepCopy);
  2678. $copyObj->setCopiedFrom($this);
  2679. return $copyObj;
  2680. }
  2681. /**
  2682. * Stores the source object that this object copied from
  2683. *
  2684. * @var Partner Clone of current object.
  2685. */
  2686. protected $copiedFrom = null;
  2687. /**
  2688. * Stores the source object that this object copied from
  2689. *
  2690. * @param Partner $copiedFrom Clone of current object.
  2691. */
  2692. public function setCopiedFrom(Partner $copiedFrom)
  2693. {
  2694. $this->copiedFrom = $copiedFrom;
  2695. }
  2696. /**
  2697. * Returns a peer instance associated with this om.
  2698. *
  2699. * Since Peer classes are not to have any instance attributes, this method returns the
  2700. * same instance for all member of this class. The method could therefore
  2701. * be static, but this would prevent one from overriding the behavior.
  2702. *
  2703. * @return PartnerPeer
  2704. */
  2705. public function getPeer()
  2706. {
  2707. if (self::$peer === null) {
  2708. self::$peer = new PartnerPeer();
  2709. }
  2710. return self::$peer;
  2711. }
  2712. /**
  2713. * Declares an association between this object and a kuser object.
  2714. *
  2715. * @param kuser $v
  2716. * @return Partner The current object (for fluent API support)
  2717. * @throws PropelException
  2718. */
  2719. public function setkuser(kuser $v = null)
  2720. {
  2721. if ($v === null) {
  2722. $this->setAnonymousKuserId(NULL);
  2723. } else {
  2724. $this->setAnonymousKuserId($v->getId());
  2725. }
  2726. $this->akuser = $v;
  2727. // Add binding for other direction of this n:n relationship.
  2728. // If this object has already been added to the kuser object, it will not be re-added.
  2729. if ($v !== null) {
  2730. $v->addPartner($this);
  2731. }
  2732. return $this;
  2733. }
  2734. /**
  2735. * Get the associated kuser object
  2736. *
  2737. * @param PropelPDO Optional Connection object.
  2738. * @return kuser The associated kuser object.
  2739. * @throws PropelException
  2740. */
  2741. public function getkuser(PropelPDO $con = null)
  2742. {
  2743. if ($this->akuser === null && ($this->anonymous_kuser_id !== null)) {
  2744. $this->akuser = kuserPeer::retrieveByPk($this->anonymous_kuser_id);
  2745. /* The following can be used additionally to
  2746. guarantee the related object contains a reference
  2747. to this object. This level of coupling may, however, be
  2748. undesirable since it could result in an only partially populated collection
  2749. in the referenced object.
  2750. $this->akuser->addPartners($this);
  2751. */
  2752. }
  2753. return $this->akuser;
  2754. }
  2755. /**
  2756. * Clears out the colladminKusers collection (array).
  2757. *
  2758. * This does not modify the database; however, it will remove any associated objects, causing
  2759. * them to be refetched by subsequent calls to accessor method.
  2760. *
  2761. * @return void
  2762. * @see addadminKusers()
  2763. */
  2764. public function clearadminKusers()
  2765. {
  2766. $this->colladminKusers = null; // important to set this to NULL since that means it is uninitialized
  2767. }
  2768. /**
  2769. * Initializes the colladminKusers collection (array).
  2770. *
  2771. * By default this just sets the colladminKusers collection to an empty array (like clearcolladminKusers());
  2772. * however, you may wish to override this method in your stub class to provide setting appropriate
  2773. * to your application -- for example, setting the initial array to the values stored in database.
  2774. *
  2775. * @return void
  2776. */
  2777. public function initadminKusers()
  2778. {
  2779. $this->colladminKusers = array();
  2780. }
  2781. /**
  2782. * Gets an array of adminKuser objects which contain a foreign key that references this object.
  2783. *
  2784. * If this collection has already been initialized with an identical Criteria, it returns the collection.
  2785. * Otherwise if this Partner has previously been saved, it will retrieve
  2786. * related adminKusers from storage. If this Partner is new, it will return
  2787. * an empty collection or the current collection, the criteria is ignored on a new object.
  2788. *
  2789. * @param PropelPDO $con
  2790. * @param Criteria $criteria
  2791. * @return array adminKuser[]
  2792. * @throws PropelException
  2793. */
  2794. public function getadminKusers($criteria = null, PropelPDO $con = null)
  2795. {
  2796. if ($criteria === null) {
  2797. $criteria = new Criteria(PartnerPeer::DATABASE_NAME);
  2798. }
  2799. elseif ($criteria instanceof Criteria)
  2800. {
  2801. $criteria = clone $criteria;
  2802. }
  2803. if ($this->colladminKusers === null) {
  2804. if ($this->isNew()) {
  2805. $this->colladminKusers = array();
  2806. } else {
  2807. $criteria->add(adminKuserPeer::PARTNER_ID, $this->id);
  2808. adminKuserPeer::addSelectColumns($criteria);
  2809. $this->colladminKusers = adminKuserPeer::doSelect($criteria, $con);
  2810. }
  2811. } else {
  2812. // criteria has no effect for a new object
  2813. if (!$this->isNew()) {
  2814. // the following code is to determine if a new query is
  2815. // called for. If the criteria is the same as the last
  2816. // one, just return the collection.
  2817. $criteria->add(adminKuserPeer::PARTNER_ID, $this->id);
  2818. adminKuserPeer::addSelectColumns($criteria);
  2819. if (!isset($this->lastadminKuserCriteria) || !$this->lastadminKuserCriteria->equals($criteria)) {
  2820. $this->colladminKusers = adminKuserPeer::doSelect($criteria, $con);
  2821. }
  2822. }
  2823. }
  2824. $this->lastadminKuserCriteria = $criteria;
  2825. return $this->colladminKusers;
  2826. }
  2827. /**
  2828. * Returns the number of related adminKuser objects.
  2829. *
  2830. * @param Criteria $criteria
  2831. * @param boolean $distinct
  2832. * @param PropelPDO $con
  2833. * @return int Count of related adminKuser objects.
  2834. * @throws PropelException
  2835. */
  2836. public function countadminKusers(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
  2837. {
  2838. if ($criteria === null) {
  2839. $criteria = new Criteria(PartnerPeer::DATABASE_NAME);
  2840. } else {
  2841. $criteria = clone $criteria;
  2842. }
  2843. if ($distinct) {
  2844. $criteria->setDistinct();
  2845. }
  2846. $count = null;
  2847. if ($this->colladminKusers === null) {
  2848. if ($this->isNew()) {
  2849. $count = 0;
  2850. } else {
  2851. $criteria->add(adminKuserPeer::PARTNER_ID, $this->id);
  2852. $count = adminKuserPeer::doCount($criteria, false, $con);
  2853. }
  2854. } else {
  2855. // criteria has no effect for a new object
  2856. if (!$this->isNew()) {
  2857. // the following code is to determine if a new query is
  2858. // called for. If the criteria is the same as the last
  2859. // one, just return count of the collection.
  2860. $criteria->add(adminKuserPeer::PARTNER_ID, $this->id);
  2861. if (!isset($this->lastadminKuserCriteria) || !$this->lastadminKuserCriteria->equals($criteria)) {
  2862. $count = adminKuserPeer::doCount($criteria, false, $con);
  2863. } else {
  2864. $count = count($this->colladminKusers);
  2865. }
  2866. } else {
  2867. $count = count($this->colladminKusers);
  2868. }
  2869. }
  2870. return $count;
  2871. }
  2872. /**
  2873. * Method called to associate a adminKuser object to this object
  2874. * through the adminKuser foreign key attribute.
  2875. *
  2876. * @param adminKuser $l adminKuser
  2877. * @return void
  2878. * @throws PropelException
  2879. */
  2880. public function addadminKuser(adminKuser $l)
  2881. {
  2882. if ($this->colladminKusers === null) {
  2883. $this->initadminKusers();
  2884. }
  2885. if (!in_array($l, $this->colladminKusers, true)) { // only add it if the **same** object is not already associated
  2886. array_push($this->colladminKusers, $l);
  2887. $l->setPartner($this);
  2888. }
  2889. }
  2890. /**
  2891. * Resets all collections of referencing foreign keys.
  2892. *
  2893. * This method is a user-space workaround for PHP's inability to garbage collect objects
  2894. * with circular references. This is currently necessary when using Propel in certain
  2895. * daemon or large-volumne/high-memory operations.
  2896. *
  2897. * @param boolean $deep Whether to also clear the references on all associated objects.
  2898. */
  2899. public function clearAllReferences($deep = false)
  2900. {
  2901. if ($deep) {
  2902. if ($this->colladminKusers) {
  2903. foreach ((array) $this->colladminKusers as $o) {
  2904. $o->clearAllReferences($deep);
  2905. }
  2906. }
  2907. } // if ($deep)
  2908. $this->colladminKusers = null;
  2909. $this->akuser = null;
  2910. }
  2911. /* ---------------------- CustomData functions ------------------------- */
  2912. /**
  2913. * @var myCustomData
  2914. */
  2915. protected $m_custom_data = null;
  2916. /**
  2917. * Store custom data old values before the changes
  2918. * @var array
  2919. */
  2920. protected $oldCustomDataValues = array();
  2921. /**
  2922. * @return array
  2923. */
  2924. public function getCustomDataOldValues()
  2925. {
  2926. return $this->oldCustomDataValues;
  2927. }
  2928. /**
  2929. * @param string $name
  2930. * @param string $value
  2931. * @param string $namespace
  2932. * @return string
  2933. */
  2934. public function putInCustomData ( $name , $value , $namespace = null )
  2935. {
  2936. $customData = $this->getCustomDataObj( );
  2937. $currentNamespace = '';
  2938. if($namespace)
  2939. $currentNamespace = $namespace;
  2940. if(!isset($this->oldCustomDataValues[$currentNamespace]))
  2941. $this->oldCustomDataValues[$currentNamespace] = array();
  2942. if(!isset($this->oldCustomDataValues[$currentNamespace][$name]))
  2943. $this->oldCustomDataValues[$currentNamespace][$name] = $customData->get($name, $namespace);
  2944. $customData->put ( $name , $value , $namespace );
  2945. }
  2946. /**
  2947. * @param string $name
  2948. * @param string $namespace
  2949. * @param string $defaultValue
  2950. * @return string
  2951. */
  2952. public function getFromCustomData ( $name , $namespace = null , $defaultValue = null )
  2953. {
  2954. $customData = $this->getCustomDataObj( );
  2955. $res = $customData->get ( $name , $namespace );
  2956. if ( $res === null ) return $defaultValue;
  2957. return $res;
  2958. }
  2959. /**
  2960. * @param string $name
  2961. * @param string $namespace
  2962. */
  2963. public function removeFromCustomData ( $name , $namespace = null)
  2964. {
  2965. $customData = $this->getCustomDataObj( );
  2966. return $customData->remove ( $name , $namespace );
  2967. }
  2968. /**
  2969. * @param string $name
  2970. * @param int $delta
  2971. * @param string $namespace
  2972. * @return string
  2973. */
  2974. public function incInCustomData ( $name , $delta = 1, $namespace = null)
  2975. {
  2976. $customData = $this->getCustomDataObj( );
  2977. return $customData->inc ( $name , $delta , $namespace );
  2978. }
  2979. /**
  2980. * @param string $name
  2981. * @param int $delta
  2982. * @param string $namespace
  2983. * @return string
  2984. */
  2985. public function decInCustomData ( $name , $delta = 1, $namespace = null)
  2986. {
  2987. $customData = $this->getCustomDataObj( );
  2988. return $customData->dec ( $name , $delta , $namespace );
  2989. }
  2990. /**
  2991. * @return myCustomData
  2992. */
  2993. public function getCustomDataObj( )
  2994. {
  2995. if ( ! $this->m_custom_data )
  2996. {
  2997. $this->m_custom_data = myCustomData::fromString ( $this->getCustomData() );
  2998. }
  2999. return $this->m_custom_data;
  3000. }
  3001. /**
  3002. * Must be called before saving the object
  3003. */
  3004. public function setCustomDataObj()
  3005. {
  3006. if ( $this->m_custom_data != null )
  3007. {
  3008. $this->setCustomData( $this->m_custom_data->toString() );
  3009. }
  3010. }
  3011. /* ---------------------- CustomData functions ------------------------- */
  3012. } // BasePartner