BaseCcLocale.php 21 KB

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