BaseCcSmemb.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892
  1. <?php
  2. /**
  3. * Base class that represents a row from the 'cc_smemb' table.
  4. *
  5. *
  6. *
  7. * @package propel.generator.airtime.om
  8. */
  9. abstract class BaseCcSmemb extends BaseObject implements Persistent
  10. {
  11. /**
  12. * Peer class name
  13. */
  14. const PEER = 'CcSmembPeer';
  15. /**
  16. * The Peer class.
  17. * Instance provides a convenient way of calling static methods on a class
  18. * that calling code may not be able to identify.
  19. * @var CcSmembPeer
  20. */
  21. protected static $peer;
  22. /**
  23. * The value for the id field.
  24. * @var int
  25. */
  26. protected $id;
  27. /**
  28. * The value for the uid field.
  29. * Note: this column has a database default value of: 0
  30. * @var int
  31. */
  32. protected $uid;
  33. /**
  34. * The value for the gid field.
  35. * Note: this column has a database default value of: 0
  36. * @var int
  37. */
  38. protected $gid;
  39. /**
  40. * The value for the level field.
  41. * Note: this column has a database default value of: 0
  42. * @var int
  43. */
  44. protected $level;
  45. /**
  46. * The value for the mid field.
  47. * @var int
  48. */
  49. protected $mid;
  50. /**
  51. * Flag to prevent endless save loop, if this object is referenced
  52. * by another object which falls in this transaction.
  53. * @var boolean
  54. */
  55. protected $alreadyInSave = false;
  56. /**
  57. * Flag to prevent endless validation loop, if this object is referenced
  58. * by another object which falls in this transaction.
  59. * @var boolean
  60. */
  61. protected $alreadyInValidation = false;
  62. /**
  63. * Applies default values to this object.
  64. * This method should be called from the object's constructor (or
  65. * equivalent initialization method).
  66. * @see __construct()
  67. */
  68. public function applyDefaultValues()
  69. {
  70. $this->uid = 0;
  71. $this->gid = 0;
  72. $this->level = 0;
  73. }
  74. /**
  75. * Initializes internal state of BaseCcSmemb object.
  76. * @see applyDefaults()
  77. */
  78. public function __construct()
  79. {
  80. parent::__construct();
  81. $this->applyDefaultValues();
  82. }
  83. /**
  84. * Get the [id] column value.
  85. *
  86. * @return int
  87. */
  88. public function getId()
  89. {
  90. return $this->id;
  91. }
  92. /**
  93. * Get the [uid] column value.
  94. *
  95. * @return int
  96. */
  97. public function getUid()
  98. {
  99. return $this->uid;
  100. }
  101. /**
  102. * Get the [gid] column value.
  103. *
  104. * @return int
  105. */
  106. public function getGid()
  107. {
  108. return $this->gid;
  109. }
  110. /**
  111. * Get the [level] column value.
  112. *
  113. * @return int
  114. */
  115. public function getLevel()
  116. {
  117. return $this->level;
  118. }
  119. /**
  120. * Get the [mid] column value.
  121. *
  122. * @return int
  123. */
  124. public function getMid()
  125. {
  126. return $this->mid;
  127. }
  128. /**
  129. * Set the value of [id] column.
  130. *
  131. * @param int $v new value
  132. * @return CcSmemb The current object (for fluent API support)
  133. */
  134. public function setId($v)
  135. {
  136. if ($v !== null) {
  137. $v = (int) $v;
  138. }
  139. if ($this->id !== $v) {
  140. $this->id = $v;
  141. $this->modifiedColumns[] = CcSmembPeer::ID;
  142. }
  143. return $this;
  144. } // setId()
  145. /**
  146. * Set the value of [uid] column.
  147. *
  148. * @param int $v new value
  149. * @return CcSmemb The current object (for fluent API support)
  150. */
  151. public function setUid($v)
  152. {
  153. if ($v !== null) {
  154. $v = (int) $v;
  155. }
  156. if ($this->uid !== $v || $this->isNew()) {
  157. $this->uid = $v;
  158. $this->modifiedColumns[] = CcSmembPeer::UID;
  159. }
  160. return $this;
  161. } // setUid()
  162. /**
  163. * Set the value of [gid] column.
  164. *
  165. * @param int $v new value
  166. * @return CcSmemb The current object (for fluent API support)
  167. */
  168. public function setGid($v)
  169. {
  170. if ($v !== null) {
  171. $v = (int) $v;
  172. }
  173. if ($this->gid !== $v || $this->isNew()) {
  174. $this->gid = $v;
  175. $this->modifiedColumns[] = CcSmembPeer::GID;
  176. }
  177. return $this;
  178. } // setGid()
  179. /**
  180. * Set the value of [level] column.
  181. *
  182. * @param int $v new value
  183. * @return CcSmemb The current object (for fluent API support)
  184. */
  185. public function setLevel($v)
  186. {
  187. if ($v !== null) {
  188. $v = (int) $v;
  189. }
  190. if ($this->level !== $v || $this->isNew()) {
  191. $this->level = $v;
  192. $this->modifiedColumns[] = CcSmembPeer::LEVEL;
  193. }
  194. return $this;
  195. } // setLevel()
  196. /**
  197. * Set the value of [mid] column.
  198. *
  199. * @param int $v new value
  200. * @return CcSmemb The current object (for fluent API support)
  201. */
  202. public function setMid($v)
  203. {
  204. if ($v !== null) {
  205. $v = (int) $v;
  206. }
  207. if ($this->mid !== $v) {
  208. $this->mid = $v;
  209. $this->modifiedColumns[] = CcSmembPeer::MID;
  210. }
  211. return $this;
  212. } // setMid()
  213. /**
  214. * Indicates whether the columns in this object are only set to default values.
  215. *
  216. * This method can be used in conjunction with isModified() to indicate whether an object is both
  217. * modified _and_ has some values set which are non-default.
  218. *
  219. * @return boolean Whether the columns in this object are only been set with default values.
  220. */
  221. public function hasOnlyDefaultValues()
  222. {
  223. if ($this->uid !== 0) {
  224. return false;
  225. }
  226. if ($this->gid !== 0) {
  227. return false;
  228. }
  229. if ($this->level !== 0) {
  230. return false;
  231. }
  232. // otherwise, everything was equal, so return TRUE
  233. return true;
  234. } // hasOnlyDefaultValues()
  235. /**
  236. * Hydrates (populates) the object variables with values from the database resultset.
  237. *
  238. * An offset (0-based "start column") is specified so that objects can be hydrated
  239. * with a subset of the columns in the resultset rows. This is needed, for example,
  240. * for results of JOIN queries where the resultset row includes columns from two or
  241. * more tables.
  242. *
  243. * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
  244. * @param int $startcol 0-based offset column which indicates which restultset column to start with.
  245. * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
  246. * @return int next starting column
  247. * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
  248. */
  249. public function hydrate($row, $startcol = 0, $rehydrate = false)
  250. {
  251. try {
  252. $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
  253. $this->uid = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
  254. $this->gid = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
  255. $this->level = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
  256. $this->mid = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
  257. $this->resetModified();
  258. $this->setNew(false);
  259. if ($rehydrate) {
  260. $this->ensureConsistency();
  261. }
  262. return $startcol + 5; // 5 = CcSmembPeer::NUM_COLUMNS - CcSmembPeer::NUM_LAZY_LOAD_COLUMNS).
  263. } catch (Exception $e) {
  264. throw new PropelException("Error populating CcSmemb object", $e);
  265. }
  266. }
  267. /**
  268. * Checks and repairs the internal consistency of the object.
  269. *
  270. * This method is executed after an already-instantiated object is re-hydrated
  271. * from the database. It exists to check any foreign keys to make sure that
  272. * the objects related to the current object are correct based on foreign key.
  273. *
  274. * You can override this method in the stub class, but you should always invoke
  275. * the base method from the overridden method (i.e. parent::ensureConsistency()),
  276. * in case your model changes.
  277. *
  278. * @throws PropelException
  279. */
  280. public function ensureConsistency()
  281. {
  282. } // ensureConsistency
  283. /**
  284. * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
  285. *
  286. * This will only work if the object has been saved and has a valid primary key set.
  287. *
  288. * @param boolean $deep (optional) Whether to also de-associated any related objects.
  289. * @param PropelPDO $con (optional) The PropelPDO connection to use.
  290. * @return void
  291. * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
  292. */
  293. public function reload($deep = false, PropelPDO $con = null)
  294. {
  295. if ($this->isDeleted()) {
  296. throw new PropelException("Cannot reload a deleted object.");
  297. }
  298. if ($this->isNew()) {
  299. throw new PropelException("Cannot reload an unsaved object.");
  300. }
  301. if ($con === null) {
  302. $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  303. }
  304. // We don't need to alter the object instance pool; we're just modifying this instance
  305. // already in the pool.
  306. $stmt = CcSmembPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
  307. $row = $stmt->fetch(PDO::FETCH_NUM);
  308. $stmt->closeCursor();
  309. if (!$row) {
  310. throw new PropelException('Cannot find matching row in the database to reload object values.');
  311. }
  312. $this->hydrate($row, 0, true); // rehydrate
  313. if ($deep) { // also de-associate any related objects?
  314. } // if (deep)
  315. }
  316. /**
  317. * Removes this object from datastore and sets delete attribute.
  318. *
  319. * @param PropelPDO $con
  320. * @return void
  321. * @throws PropelException
  322. * @see BaseObject::setDeleted()
  323. * @see BaseObject::isDeleted()
  324. */
  325. public function delete(PropelPDO $con = null)
  326. {
  327. if ($this->isDeleted()) {
  328. throw new PropelException("This object has already been deleted.");
  329. }
  330. if ($con === null) {
  331. $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  332. }
  333. $con->beginTransaction();
  334. try {
  335. $ret = $this->preDelete($con);
  336. if ($ret) {
  337. CcSmembQuery::create()
  338. ->filterByPrimaryKey($this->getPrimaryKey())
  339. ->delete($con);
  340. $this->postDelete($con);
  341. $con->commit();
  342. $this->setDeleted(true);
  343. } else {
  344. $con->commit();
  345. }
  346. } catch (PropelException $e) {
  347. $con->rollBack();
  348. throw $e;
  349. }
  350. }
  351. /**
  352. * Persists this object to the database.
  353. *
  354. * If the object is new, it inserts it; otherwise an update is performed.
  355. * All modified related objects will also be persisted in the doSave()
  356. * method. This method wraps all precipitate database operations in a
  357. * single transaction.
  358. *
  359. * @param PropelPDO $con
  360. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  361. * @throws PropelException
  362. * @see doSave()
  363. */
  364. public function save(PropelPDO $con = null)
  365. {
  366. if ($this->isDeleted()) {
  367. throw new PropelException("You cannot save an object that has been deleted.");
  368. }
  369. if ($con === null) {
  370. $con = Propel::getConnection(CcSmembPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  371. }
  372. $con->beginTransaction();
  373. $isInsert = $this->isNew();
  374. try {
  375. $ret = $this->preSave($con);
  376. if ($isInsert) {
  377. $ret = $ret && $this->preInsert($con);
  378. } else {
  379. $ret = $ret && $this->preUpdate($con);
  380. }
  381. if ($ret) {
  382. $affectedRows = $this->doSave($con);
  383. if ($isInsert) {
  384. $this->postInsert($con);
  385. } else {
  386. $this->postUpdate($con);
  387. }
  388. $this->postSave($con);
  389. CcSmembPeer::addInstanceToPool($this);
  390. } else {
  391. $affectedRows = 0;
  392. }
  393. $con->commit();
  394. return $affectedRows;
  395. } catch (PropelException $e) {
  396. $con->rollBack();
  397. throw $e;
  398. }
  399. }
  400. /**
  401. * Performs the work of inserting or updating the row in the database.
  402. *
  403. * If the object is new, it inserts it; otherwise an update is performed.
  404. * All related objects are also updated in this method.
  405. *
  406. * @param PropelPDO $con
  407. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  408. * @throws PropelException
  409. * @see save()
  410. */
  411. protected function doSave(PropelPDO $con)
  412. {
  413. $affectedRows = 0; // initialize var to track total num of affected rows
  414. if (!$this->alreadyInSave) {
  415. $this->alreadyInSave = true;
  416. // If this object has been modified, then save it to the database.
  417. if ($this->isModified()) {
  418. if ($this->isNew()) {
  419. $criteria = $this->buildCriteria();
  420. $pk = BasePeer::doInsert($criteria, $con);
  421. $affectedRows = 1;
  422. $this->setNew(false);
  423. } else {
  424. $affectedRows = CcSmembPeer::doUpdate($this, $con);
  425. }
  426. $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
  427. }
  428. $this->alreadyInSave = false;
  429. }
  430. return $affectedRows;
  431. } // doSave()
  432. /**
  433. * Array of ValidationFailed objects.
  434. * @var array ValidationFailed[]
  435. */
  436. protected $validationFailures = array();
  437. /**
  438. * Gets any ValidationFailed objects that resulted from last call to validate().
  439. *
  440. *
  441. * @return array ValidationFailed[]
  442. * @see validate()
  443. */
  444. public function getValidationFailures()
  445. {
  446. return $this->validationFailures;
  447. }
  448. /**
  449. * Validates the objects modified field values and all objects related to this table.
  450. *
  451. * If $columns is either a column name or an array of column names
  452. * only those columns are validated.
  453. *
  454. * @param mixed $columns Column name or an array of column names.
  455. * @return boolean Whether all columns pass validation.
  456. * @see doValidate()
  457. * @see getValidationFailures()
  458. */
  459. public function validate($columns = null)
  460. {
  461. $res = $this->doValidate($columns);
  462. if ($res === true) {
  463. $this->validationFailures = array();
  464. return true;
  465. } else {
  466. $this->validationFailures = $res;
  467. return false;
  468. }
  469. }
  470. /**
  471. * This function performs the validation work for complex object models.
  472. *
  473. * In addition to checking the current object, all related objects will
  474. * also be validated. If all pass then <code>true</code> is returned; otherwise
  475. * an aggreagated array of ValidationFailed objects will be returned.
  476. *
  477. * @param array $columns Array of column names to validate.
  478. * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  479. */
  480. protected function doValidate($columns = null)
  481. {
  482. if (!$this->alreadyInValidation) {
  483. $this->alreadyInValidation = true;
  484. $retval = null;
  485. $failureMap = array();
  486. if (($retval = CcSmembPeer::doValidate($this, $columns)) !== true) {
  487. $failureMap = array_merge($failureMap, $retval);
  488. }
  489. $this->alreadyInValidation = false;
  490. }
  491. return (!empty($failureMap) ? $failureMap : true);
  492. }
  493. /**
  494. * Retrieves a field from the object by name passed in as a string.
  495. *
  496. * @param string $name name
  497. * @param string $type The type of fieldname the $name is of:
  498. * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  499. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  500. * @return mixed Value of field.
  501. */
  502. public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
  503. {
  504. $pos = CcSmembPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  505. $field = $this->getByPosition($pos);
  506. return $field;
  507. }
  508. /**
  509. * Retrieves a field from the object by Position as specified in the xml schema.
  510. * Zero-based.
  511. *
  512. * @param int $pos position in xml schema
  513. * @return mixed Value of field at $pos
  514. */
  515. public function getByPosition($pos)
  516. {
  517. switch($pos) {
  518. case 0:
  519. return $this->getId();
  520. break;
  521. case 1:
  522. return $this->getUid();
  523. break;
  524. case 2:
  525. return $this->getGid();
  526. break;
  527. case 3:
  528. return $this->getLevel();
  529. break;
  530. case 4:
  531. return $this->getMid();
  532. break;
  533. default:
  534. return null;
  535. break;
  536. } // switch()
  537. }
  538. /**
  539. * Exports the object as an array.
  540. *
  541. * You can specify the key type of the array by passing one of the class
  542. * type constants.
  543. *
  544. * @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  545. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  546. * Defaults to BasePeer::TYPE_PHPNAME.
  547. * @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  548. *
  549. * @return array an associative array containing the field names (as keys) and field values
  550. */
  551. public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
  552. {
  553. $keys = CcSmembPeer::getFieldNames($keyType);
  554. $result = array(
  555. $keys[0] => $this->getId(),
  556. $keys[1] => $this->getUid(),
  557. $keys[2] => $this->getGid(),
  558. $keys[3] => $this->getLevel(),
  559. $keys[4] => $this->getMid(),
  560. );
  561. return $result;
  562. }
  563. /**
  564. * Sets a field from the object by name passed in as a string.
  565. *
  566. * @param string $name peer name
  567. * @param mixed $value field value
  568. * @param string $type The type of fieldname the $name is of:
  569. * one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  570. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  571. * @return void
  572. */
  573. public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
  574. {
  575. $pos = CcSmembPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  576. return $this->setByPosition($pos, $value);
  577. }
  578. /**
  579. * Sets a field from the object by Position as specified in the xml schema.
  580. * Zero-based.
  581. *
  582. * @param int $pos position in xml schema
  583. * @param mixed $value field value
  584. * @return void
  585. */
  586. public function setByPosition($pos, $value)
  587. {
  588. switch($pos) {
  589. case 0:
  590. $this->setId($value);
  591. break;
  592. case 1:
  593. $this->setUid($value);
  594. break;
  595. case 2:
  596. $this->setGid($value);
  597. break;
  598. case 3:
  599. $this->setLevel($value);
  600. break;
  601. case 4:
  602. $this->setMid($value);
  603. break;
  604. } // switch()
  605. }
  606. /**
  607. * Populates the object using an array.
  608. *
  609. * This is particularly useful when populating an object from one of the
  610. * request arrays (e.g. $_POST). This method goes through the column
  611. * names, checking to see whether a matching key exists in populated
  612. * array. If so the setByName() method is called for that column.
  613. *
  614. * You can specify the key type of the array by additionally passing one
  615. * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  616. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  617. * The default key type is the column's phpname (e.g. 'AuthorId')
  618. *
  619. * @param array $arr An array to populate the object from.
  620. * @param string $keyType The type of keys the array uses.
  621. * @return void
  622. */
  623. public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
  624. {
  625. $keys = CcSmembPeer::getFieldNames($keyType);
  626. if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
  627. if (array_key_exists($keys[1], $arr)) $this->setUid($arr[$keys[1]]);
  628. if (array_key_exists($keys[2], $arr)) $this->setGid($arr[$keys[2]]);
  629. if (array_key_exists($keys[3], $arr)) $this->setLevel($arr[$keys[3]]);
  630. if (array_key_exists($keys[4], $arr)) $this->setMid($arr[$keys[4]]);
  631. }
  632. /**
  633. * Build a Criteria object containing the values of all modified columns in this object.
  634. *
  635. * @return Criteria The Criteria object containing all modified values.
  636. */
  637. public function buildCriteria()
  638. {
  639. $criteria = new Criteria(CcSmembPeer::DATABASE_NAME);
  640. if ($this->isColumnModified(CcSmembPeer::ID)) $criteria->add(CcSmembPeer::ID, $this->id);
  641. if ($this->isColumnModified(CcSmembPeer::UID)) $criteria->add(CcSmembPeer::UID, $this->uid);
  642. if ($this->isColumnModified(CcSmembPeer::GID)) $criteria->add(CcSmembPeer::GID, $this->gid);
  643. if ($this->isColumnModified(CcSmembPeer::LEVEL)) $criteria->add(CcSmembPeer::LEVEL, $this->level);
  644. if ($this->isColumnModified(CcSmembPeer::MID)) $criteria->add(CcSmembPeer::MID, $this->mid);
  645. return $criteria;
  646. }
  647. /**
  648. * Builds a Criteria object containing the primary key for this object.
  649. *
  650. * Unlike buildCriteria() this method includes the primary key values regardless
  651. * of whether or not they have been modified.
  652. *
  653. * @return Criteria The Criteria object containing value(s) for primary key(s).
  654. */
  655. public function buildPkeyCriteria()
  656. {
  657. $criteria = new Criteria(CcSmembPeer::DATABASE_NAME);
  658. $criteria->add(CcSmembPeer::ID, $this->id);
  659. return $criteria;
  660. }
  661. /**
  662. * Returns the primary key for this object (row).
  663. * @return int
  664. */
  665. public function getPrimaryKey()
  666. {
  667. return $this->getId();
  668. }
  669. /**
  670. * Generic method to set the primary key (id column).
  671. *
  672. * @param int $key Primary key.
  673. * @return void
  674. */
  675. public function setPrimaryKey($key)
  676. {
  677. $this->setId($key);
  678. }
  679. /**
  680. * Returns true if the primary key for this object is null.
  681. * @return boolean
  682. */
  683. public function isPrimaryKeyNull()
  684. {
  685. return null === $this->getId();
  686. }
  687. /**
  688. * Sets contents of passed object to values from current object.
  689. *
  690. * If desired, this method can also make copies of all associated (fkey referrers)
  691. * objects.
  692. *
  693. * @param object $copyObj An object of CcSmemb (or compatible) type.
  694. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  695. * @throws PropelException
  696. */
  697. public function copyInto($copyObj, $deepCopy = false)
  698. {
  699. $copyObj->setId($this->id);
  700. $copyObj->setUid($this->uid);
  701. $copyObj->setGid($this->gid);
  702. $copyObj->setLevel($this->level);
  703. $copyObj->setMid($this->mid);
  704. $copyObj->setNew(true);
  705. }
  706. /**
  707. * Makes a copy of this object that will be inserted as a new row in table when saved.
  708. * It creates a new object filling in the simple attributes, but skipping any primary
  709. * keys that are defined for the table.
  710. *
  711. * If desired, this method can also make copies of all associated (fkey referrers)
  712. * objects.
  713. *
  714. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  715. * @return CcSmemb Clone of current object.
  716. * @throws PropelException
  717. */
  718. public function copy($deepCopy = false)
  719. {
  720. // we use get_class(), because this might be a subclass
  721. $clazz = get_class($this);
  722. $copyObj = new $clazz();
  723. $this->copyInto($copyObj, $deepCopy);
  724. return $copyObj;
  725. }
  726. /**
  727. * Returns a peer instance associated with this om.
  728. *
  729. * Since Peer classes are not to have any instance attributes, this method returns the
  730. * same instance for all member of this class. The method could therefore
  731. * be static, but this would prevent one from overriding the behavior.
  732. *
  733. * @return CcSmembPeer
  734. */
  735. public function getPeer()
  736. {
  737. if (self::$peer === null) {
  738. self::$peer = new CcSmembPeer();
  739. }
  740. return self::$peer;
  741. }
  742. /**
  743. * Clears the current object and sets all attributes to their default values
  744. */
  745. public function clear()
  746. {
  747. $this->id = null;
  748. $this->uid = null;
  749. $this->gid = null;
  750. $this->level = null;
  751. $this->mid = null;
  752. $this->alreadyInSave = false;
  753. $this->alreadyInValidation = false;
  754. $this->clearAllReferences();
  755. $this->applyDefaultValues();
  756. $this->resetModified();
  757. $this->setNew(true);
  758. $this->setDeleted(false);
  759. }
  760. /**
  761. * Resets all collections of referencing foreign keys.
  762. *
  763. * This method is a user-space workaround for PHP's inability to garbage collect objects
  764. * with circular references. This is currently necessary when using Propel in certain
  765. * daemon or large-volumne/high-memory operations.
  766. *
  767. * @param boolean $deep Whether to also clear the references on all associated objects.
  768. */
  769. public function clearAllReferences($deep = false)
  770. {
  771. if ($deep) {
  772. } // if ($deep)
  773. }
  774. /**
  775. * Catches calls to virtual methods
  776. */
  777. public function __call($name, $params)
  778. {
  779. if (preg_match('/get(\w+)/', $name, $matches)) {
  780. $virtualColumn = $matches[1];
  781. if ($this->hasVirtualColumn($virtualColumn)) {
  782. return $this->getVirtualColumn($virtualColumn);
  783. }
  784. // no lcfirst in php<5.3...
  785. $virtualColumn[0] = strtolower($virtualColumn[0]);
  786. if ($this->hasVirtualColumn($virtualColumn)) {
  787. return $this->getVirtualColumn($virtualColumn);
  788. }
  789. }
  790. throw new PropelException('Call to undefined method: ' . $name);
  791. }
  792. } // BaseCcSmemb