BaseKataoMemberGroup.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790
  1. <?php
  2. /**
  3. * Base class that represents a row from the 'katao_member_group' table.
  4. *
  5. *
  6. *
  7. * @package lib.model.om
  8. */
  9. abstract class BaseKataoMemberGroup extends BaseObject implements Persistent {
  10. /**
  11. * The Peer class.
  12. * Instance provides a convenient way of calling static methods on a class
  13. * that calling code may not be able to identify.
  14. * @var KataoMemberGroupPeer
  15. */
  16. protected static $peer;
  17. /**
  18. * The value for the id field.
  19. * @var int
  20. */
  21. protected $id;
  22. /**
  23. * The value for the katao_member_group_name field.
  24. * @var string
  25. */
  26. protected $katao_member_group_name;
  27. /**
  28. * Collection to store aggregation of collKataoAssocMemberGroups.
  29. * @var array
  30. */
  31. protected $collKataoAssocMemberGroups;
  32. /**
  33. * The criteria used to select the current contents of collKataoAssocMemberGroups.
  34. * @var Criteria
  35. */
  36. protected $lastKataoAssocMemberGroupCriteria = null;
  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 getId()
  55. {
  56. return $this->id;
  57. }
  58. /**
  59. * Get the [katao_member_group_name] column value.
  60. *
  61. * @return string
  62. */
  63. public function getKataoMemberGroupName()
  64. {
  65. return $this->katao_member_group_name;
  66. }
  67. /**
  68. * Set the value of [id] column.
  69. *
  70. * @param int $v new value
  71. * @return void
  72. */
  73. public function setId($v)
  74. {
  75. // Since the native PHP type for this column is integer,
  76. // we will cast the input value to an int (if it is not).
  77. if ($v !== null && !is_int($v) && is_numeric($v)) {
  78. $v = (int) $v;
  79. }
  80. if ($this->id !== $v) {
  81. $this->id = $v;
  82. $this->modifiedColumns[] = KataoMemberGroupPeer::ID;
  83. }
  84. } // setId()
  85. /**
  86. * Set the value of [katao_member_group_name] column.
  87. *
  88. * @param string $v new value
  89. * @return void
  90. */
  91. public function setKataoMemberGroupName($v)
  92. {
  93. // Since the native PHP type for this column is string,
  94. // we will cast the input to a string (if it is not).
  95. if ($v !== null && !is_string($v)) {
  96. $v = (string) $v;
  97. }
  98. if ($this->katao_member_group_name !== $v) {
  99. $this->katao_member_group_name = $v;
  100. $this->modifiedColumns[] = KataoMemberGroupPeer::KATAO_MEMBER_GROUP_NAME;
  101. }
  102. } // setKataoMemberGroupName()
  103. /**
  104. * Hydrates (populates) the object variables with values from the database resultset.
  105. *
  106. * An offset (1-based "start column") is specified so that objects can be hydrated
  107. * with a subset of the columns in the resultset rows. This is needed, for example,
  108. * for results of JOIN queries where the resultset row includes columns from two or
  109. * more tables.
  110. *
  111. * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
  112. * @param int $startcol 1-based offset column which indicates which restultset column to start with.
  113. * @return int next starting column
  114. * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
  115. */
  116. public function hydrate(ResultSet $rs, $startcol = 1)
  117. {
  118. try {
  119. $this->id = $rs->getInt($startcol + 0);
  120. $this->katao_member_group_name = $rs->getString($startcol + 1);
  121. $this->resetModified();
  122. $this->setNew(false);
  123. // FIXME - using NUM_COLUMNS may be clearer.
  124. return $startcol + 2; // 2 = KataoMemberGroupPeer::NUM_COLUMNS - KataoMemberGroupPeer::NUM_LAZY_LOAD_COLUMNS).
  125. } catch (Exception $e) {
  126. throw new PropelException("Error populating KataoMemberGroup object", $e);
  127. }
  128. }
  129. /**
  130. * Removes this object from datastore and sets delete attribute.
  131. *
  132. * @param Connection $con
  133. * @return void
  134. * @throws PropelException
  135. * @see BaseObject::setDeleted()
  136. * @see BaseObject::isDeleted()
  137. */
  138. public function delete($con = null)
  139. {
  140. foreach (sfMixer::getCallables('BaseKataoMemberGroup:delete:pre') as $callable)
  141. {
  142. $ret = call_user_func($callable, $this, $con);
  143. if ($ret)
  144. {
  145. return;
  146. }
  147. }
  148. if ($this->isDeleted()) {
  149. throw new PropelException("This object has already been deleted.");
  150. }
  151. if ($con === null) {
  152. $con = Propel::getConnection(KataoMemberGroupPeer::DATABASE_NAME);
  153. }
  154. try {
  155. $con->begin();
  156. KataoMemberGroupPeer::doDelete($this, $con);
  157. $this->setDeleted(true);
  158. $con->commit();
  159. } catch (PropelException $e) {
  160. $con->rollback();
  161. throw $e;
  162. }
  163. foreach (sfMixer::getCallables('BaseKataoMemberGroup:delete:post') as $callable)
  164. {
  165. call_user_func($callable, $this, $con);
  166. }
  167. }
  168. /**
  169. * Stores the object in the database. If the object is new,
  170. * it inserts it; otherwise an update is performed. This method
  171. * wraps the doSave() worker method in a transaction.
  172. *
  173. * @param Connection $con
  174. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  175. * @throws PropelException
  176. * @see doSave()
  177. */
  178. public function save($con = null)
  179. {
  180. foreach (sfMixer::getCallables('BaseKataoMemberGroup:save:pre') as $callable)
  181. {
  182. $affectedRows = call_user_func($callable, $this, $con);
  183. if (is_int($affectedRows))
  184. {
  185. return $affectedRows;
  186. }
  187. }
  188. if ($this->isDeleted()) {
  189. throw new PropelException("You cannot save an object that has been deleted.");
  190. }
  191. if ($con === null) {
  192. $con = Propel::getConnection(KataoMemberGroupPeer::DATABASE_NAME);
  193. }
  194. try {
  195. $con->begin();
  196. $affectedRows = $this->doSave($con);
  197. $con->commit();
  198. foreach (sfMixer::getCallables('BaseKataoMemberGroup:save:post') as $callable)
  199. {
  200. call_user_func($callable, $this, $con, $affectedRows);
  201. }
  202. return $affectedRows;
  203. } catch (PropelException $e) {
  204. $con->rollback();
  205. throw $e;
  206. }
  207. }
  208. /**
  209. * Stores the object in the database.
  210. *
  211. * If the object is new, it inserts it; otherwise an update is performed.
  212. * All related objects are also updated in this method.
  213. *
  214. * @param Connection $con
  215. * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  216. * @throws PropelException
  217. * @see save()
  218. */
  219. protected function doSave($con)
  220. {
  221. $affectedRows = 0; // initialize var to track total num of affected rows
  222. if (!$this->alreadyInSave) {
  223. $this->alreadyInSave = true;
  224. // If this object has been modified, then save it to the database.
  225. if ($this->isModified()) {
  226. if ($this->isNew()) {
  227. $pk = KataoMemberGroupPeer::doInsert($this, $con);
  228. $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
  229. // should always be true here (even though technically
  230. // BasePeer::doInsert() can insert multiple rows).
  231. $this->setId($pk); //[IMV] update autoincrement primary key
  232. $this->setNew(false);
  233. } else {
  234. $affectedRows += KataoMemberGroupPeer::doUpdate($this, $con);
  235. }
  236. $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
  237. }
  238. if ($this->collKataoAssocMemberGroups !== null) {
  239. foreach($this->collKataoAssocMemberGroups as $referrerFK) {
  240. if (!$referrerFK->isDeleted()) {
  241. $affectedRows += $referrerFK->save($con);
  242. }
  243. }
  244. }
  245. $this->alreadyInSave = false;
  246. }
  247. return $affectedRows;
  248. } // doSave()
  249. /**
  250. * Array of ValidationFailed objects.
  251. * @var array ValidationFailed[]
  252. */
  253. protected $validationFailures = array();
  254. /**
  255. * Gets any ValidationFailed objects that resulted from last call to validate().
  256. *
  257. *
  258. * @return array ValidationFailed[]
  259. * @see validate()
  260. */
  261. public function getValidationFailures()
  262. {
  263. return $this->validationFailures;
  264. }
  265. /**
  266. * Validates the objects modified field values and all objects related to this table.
  267. *
  268. * If $columns is either a column name or an array of column names
  269. * only those columns are validated.
  270. *
  271. * @param mixed $columns Column name or an array of column names.
  272. * @return boolean Whether all columns pass validation.
  273. * @see doValidate()
  274. * @see getValidationFailures()
  275. */
  276. public function validate($columns = null)
  277. {
  278. $res = $this->doValidate($columns);
  279. if ($res === true) {
  280. $this->validationFailures = array();
  281. return true;
  282. } else {
  283. $this->validationFailures = $res;
  284. return false;
  285. }
  286. }
  287. /**
  288. * This function performs the validation work for complex object models.
  289. *
  290. * In addition to checking the current object, all related objects will
  291. * also be validated. If all pass then <code>true</code> is returned; otherwise
  292. * an aggreagated array of ValidationFailed objects will be returned.
  293. *
  294. * @param array $columns Array of column names to validate.
  295. * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
  296. */
  297. protected function doValidate($columns = null)
  298. {
  299. if (!$this->alreadyInValidation) {
  300. $this->alreadyInValidation = true;
  301. $retval = null;
  302. $failureMap = array();
  303. if (($retval = KataoMemberGroupPeer::doValidate($this, $columns)) !== true) {
  304. $failureMap = array_merge($failureMap, $retval);
  305. }
  306. if ($this->collKataoAssocMemberGroups !== null) {
  307. foreach($this->collKataoAssocMemberGroups as $referrerFK) {
  308. if (!$referrerFK->validate($columns)) {
  309. $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
  310. }
  311. }
  312. }
  313. $this->alreadyInValidation = false;
  314. }
  315. return (!empty($failureMap) ? $failureMap : true);
  316. }
  317. /**
  318. * Retrieves a field from the object by name passed in as a string.
  319. *
  320. * @param string $name name
  321. * @param string $type The type of fieldname the $name is of:
  322. * one of the class type constants TYPE_PHPNAME,
  323. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  324. * @return mixed Value of field.
  325. */
  326. public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
  327. {
  328. $pos = KataoMemberGroupPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  329. return $this->getByPosition($pos);
  330. }
  331. /**
  332. * Retrieves a field from the object by Position as specified in the xml schema.
  333. * Zero-based.
  334. *
  335. * @param int $pos position in xml schema
  336. * @return mixed Value of field at $pos
  337. */
  338. public function getByPosition($pos)
  339. {
  340. switch($pos) {
  341. case 0:
  342. return $this->getId();
  343. break;
  344. case 1:
  345. return $this->getKataoMemberGroupName();
  346. break;
  347. default:
  348. return null;
  349. break;
  350. } // switch()
  351. }
  352. /**
  353. * Exports the object as an array.
  354. *
  355. * You can specify the key type of the array by passing one of the class
  356. * type constants.
  357. *
  358. * @param string $keyType One of the class type constants TYPE_PHPNAME,
  359. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  360. * @return an associative array containing the field names (as keys) and field values
  361. */
  362. public function toArray($keyType = BasePeer::TYPE_PHPNAME)
  363. {
  364. $keys = KataoMemberGroupPeer::getFieldNames($keyType);
  365. $result = array(
  366. $keys[0] => $this->getId(),
  367. $keys[1] => $this->getKataoMemberGroupName(),
  368. );
  369. return $result;
  370. }
  371. /**
  372. * Sets a field from the object by name passed in as a string.
  373. *
  374. * @param string $name peer name
  375. * @param mixed $value field value
  376. * @param string $type The type of fieldname the $name is of:
  377. * one of the class type constants TYPE_PHPNAME,
  378. * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
  379. * @return void
  380. */
  381. public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
  382. {
  383. $pos = KataoMemberGroupPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
  384. return $this->setByPosition($pos, $value);
  385. }
  386. /**
  387. * Sets a field from the object by Position as specified in the xml schema.
  388. * Zero-based.
  389. *
  390. * @param int $pos position in xml schema
  391. * @param mixed $value field value
  392. * @return void
  393. */
  394. public function setByPosition($pos, $value)
  395. {
  396. switch($pos) {
  397. case 0:
  398. $this->setId($value);
  399. break;
  400. case 1:
  401. $this->setKataoMemberGroupName($value);
  402. break;
  403. } // switch()
  404. }
  405. /**
  406. * Populates the object using an array.
  407. *
  408. * This is particularly useful when populating an object from one of the
  409. * request arrays (e.g. $_POST). This method goes through the column
  410. * names, checking to see whether a matching key exists in populated
  411. * array. If so the setByName() method is called for that column.
  412. *
  413. * You can specify the key type of the array by additionally passing one
  414. * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
  415. * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
  416. *
  417. * @param array $arr An array to populate the object from.
  418. * @param string $keyType The type of keys the array uses.
  419. * @return void
  420. */
  421. public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
  422. {
  423. $keys = KataoMemberGroupPeer::getFieldNames($keyType);
  424. if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
  425. if (array_key_exists($keys[1], $arr)) $this->setKataoMemberGroupName($arr[$keys[1]]);
  426. }
  427. /**
  428. * Build a Criteria object containing the values of all modified columns in this object.
  429. *
  430. * @return Criteria The Criteria object containing all modified values.
  431. */
  432. public function buildCriteria()
  433. {
  434. $criteria = new Criteria(KataoMemberGroupPeer::DATABASE_NAME);
  435. if ($this->isColumnModified(KataoMemberGroupPeer::ID)) $criteria->add(KataoMemberGroupPeer::ID, $this->id);
  436. if ($this->isColumnModified(KataoMemberGroupPeer::KATAO_MEMBER_GROUP_NAME)) $criteria->add(KataoMemberGroupPeer::KATAO_MEMBER_GROUP_NAME, $this->katao_member_group_name);
  437. return $criteria;
  438. }
  439. /**
  440. * Builds a Criteria object containing the primary key for this object.
  441. *
  442. * Unlike buildCriteria() this method includes the primary key values regardless
  443. * of whether or not they have been modified.
  444. *
  445. * @return Criteria The Criteria object containing value(s) for primary key(s).
  446. */
  447. public function buildPkeyCriteria()
  448. {
  449. $criteria = new Criteria(KataoMemberGroupPeer::DATABASE_NAME);
  450. $criteria->add(KataoMemberGroupPeer::ID, $this->id);
  451. return $criteria;
  452. }
  453. /**
  454. * Returns the primary key for this object (row).
  455. * @return int
  456. */
  457. public function getPrimaryKey()
  458. {
  459. return $this->getId();
  460. }
  461. /**
  462. * Generic method to set the primary key (id column).
  463. *
  464. * @param int $key Primary key.
  465. * @return void
  466. */
  467. public function setPrimaryKey($key)
  468. {
  469. $this->setId($key);
  470. }
  471. /**
  472. * Sets contents of passed object to values from current object.
  473. *
  474. * If desired, this method can also make copies of all associated (fkey referrers)
  475. * objects.
  476. *
  477. * @param object $copyObj An object of KataoMemberGroup (or compatible) type.
  478. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  479. * @throws PropelException
  480. */
  481. public function copyInto($copyObj, $deepCopy = false)
  482. {
  483. $copyObj->setKataoMemberGroupName($this->katao_member_group_name);
  484. if ($deepCopy) {
  485. // important: temporarily setNew(false) because this affects the behavior of
  486. // the getter/setter methods for fkey referrer objects.
  487. $copyObj->setNew(false);
  488. foreach($this->getKataoAssocMemberGroups() as $relObj) {
  489. $copyObj->addKataoAssocMemberGroup($relObj->copy($deepCopy));
  490. }
  491. } // if ($deepCopy)
  492. $copyObj->setNew(true);
  493. $copyObj->setId(NULL); // this is a pkey column, so set to default value
  494. }
  495. /**
  496. * Makes a copy of this object that will be inserted as a new row in table when saved.
  497. * It creates a new object filling in the simple attributes, but skipping any primary
  498. * keys that are defined for the table.
  499. *
  500. * If desired, this method can also make copies of all associated (fkey referrers)
  501. * objects.
  502. *
  503. * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
  504. * @return KataoMemberGroup Clone of current object.
  505. * @throws PropelException
  506. */
  507. public function copy($deepCopy = false)
  508. {
  509. // we use get_class(), because this might be a subclass
  510. $clazz = get_class($this);
  511. $copyObj = new $clazz();
  512. $this->copyInto($copyObj, $deepCopy);
  513. return $copyObj;
  514. }
  515. /**
  516. * Returns a peer instance associated with this om.
  517. *
  518. * Since Peer classes are not to have any instance attributes, this method returns the
  519. * same instance for all member of this class. The method could therefore
  520. * be static, but this would prevent one from overriding the behavior.
  521. *
  522. * @return KataoMemberGroupPeer
  523. */
  524. public function getPeer()
  525. {
  526. if (self::$peer === null) {
  527. self::$peer = new KataoMemberGroupPeer();
  528. }
  529. return self::$peer;
  530. }
  531. /**
  532. * Temporary storage of collKataoAssocMemberGroups to save a possible db hit in
  533. * the event objects are add to the collection, but the
  534. * complete collection is never requested.
  535. * @return void
  536. */
  537. public function initKataoAssocMemberGroups()
  538. {
  539. if ($this->collKataoAssocMemberGroups === null) {
  540. $this->collKataoAssocMemberGroups = array();
  541. }
  542. }
  543. /**
  544. * If this collection has already been initialized with
  545. * an identical criteria, it returns the collection.
  546. * Otherwise if this KataoMemberGroup has previously
  547. * been saved, it will retrieve related KataoAssocMemberGroups from storage.
  548. * If this KataoMemberGroup is new, it will return
  549. * an empty collection or the current collection, the criteria
  550. * is ignored on a new object.
  551. *
  552. * @param Connection $con
  553. * @param Criteria $criteria
  554. * @throws PropelException
  555. */
  556. public function getKataoAssocMemberGroups($criteria = null, $con = null)
  557. {
  558. // include the Peer class
  559. if ($criteria === null) {
  560. $criteria = new Criteria();
  561. }
  562. elseif ($criteria instanceof Criteria)
  563. {
  564. $criteria = clone $criteria;
  565. }
  566. if ($this->collKataoAssocMemberGroups === null) {
  567. if ($this->isNew()) {
  568. $this->collKataoAssocMemberGroups = array();
  569. } else {
  570. $criteria->add(KataoAssocMemberGroupPeer::GROUP_ID, $this->getId());
  571. KataoAssocMemberGroupPeer::addSelectColumns($criteria);
  572. $this->collKataoAssocMemberGroups = KataoAssocMemberGroupPeer::doSelect($criteria, $con);
  573. }
  574. } else {
  575. // criteria has no effect for a new object
  576. if (!$this->isNew()) {
  577. // the following code is to determine if a new query is
  578. // called for. If the criteria is the same as the last
  579. // one, just return the collection.
  580. $criteria->add(KataoAssocMemberGroupPeer::GROUP_ID, $this->getId());
  581. KataoAssocMemberGroupPeer::addSelectColumns($criteria);
  582. if (!isset($this->lastKataoAssocMemberGroupCriteria) || !$this->lastKataoAssocMemberGroupCriteria->equals($criteria)) {
  583. $this->collKataoAssocMemberGroups = KataoAssocMemberGroupPeer::doSelect($criteria, $con);
  584. }
  585. }
  586. }
  587. $this->lastKataoAssocMemberGroupCriteria = $criteria;
  588. return $this->collKataoAssocMemberGroups;
  589. }
  590. /**
  591. * Returns the number of related KataoAssocMemberGroups.
  592. *
  593. * @param Criteria $criteria
  594. * @param boolean $distinct
  595. * @param Connection $con
  596. * @throws PropelException
  597. */
  598. public function countKataoAssocMemberGroups($criteria = null, $distinct = false, $con = null)
  599. {
  600. // include the Peer class
  601. if ($criteria === null) {
  602. $criteria = new Criteria();
  603. }
  604. elseif ($criteria instanceof Criteria)
  605. {
  606. $criteria = clone $criteria;
  607. }
  608. $criteria->add(KataoAssocMemberGroupPeer::GROUP_ID, $this->getId());
  609. return KataoAssocMemberGroupPeer::doCount($criteria, $distinct, $con);
  610. }
  611. /**
  612. * Method called to associate a KataoAssocMemberGroup object to this object
  613. * through the KataoAssocMemberGroup foreign key attribute
  614. *
  615. * @param KataoAssocMemberGroup $l KataoAssocMemberGroup
  616. * @return void
  617. * @throws PropelException
  618. */
  619. public function addKataoAssocMemberGroup(KataoAssocMemberGroup $l)
  620. {
  621. $this->collKataoAssocMemberGroups[] = $l;
  622. $l->setKataoMemberGroup($this);
  623. }
  624. /**
  625. * If this collection has already been initialized with
  626. * an identical criteria, it returns the collection.
  627. * Otherwise if this KataoMemberGroup is new, it will return
  628. * an empty collection; or if this KataoMemberGroup has previously
  629. * been saved, it will retrieve related KataoAssocMemberGroups from storage.
  630. *
  631. * This method is protected by default in order to keep the public
  632. * api reasonable. You can provide public methods for those you
  633. * actually need in KataoMemberGroup.
  634. */
  635. public function getKataoAssocMemberGroupsJoinKataoMember($criteria = null, $con = null)
  636. {
  637. // include the Peer class
  638. if ($criteria === null) {
  639. $criteria = new Criteria();
  640. }
  641. elseif ($criteria instanceof Criteria)
  642. {
  643. $criteria = clone $criteria;
  644. }
  645. if ($this->collKataoAssocMemberGroups === null) {
  646. if ($this->isNew()) {
  647. $this->collKataoAssocMemberGroups = array();
  648. } else {
  649. $criteria->add(KataoAssocMemberGroupPeer::GROUP_ID, $this->getId());
  650. $this->collKataoAssocMemberGroups = KataoAssocMemberGroupPeer::doSelectJoinKataoMember($criteria, $con);
  651. }
  652. } else {
  653. // the following code is to determine if a new query is
  654. // called for. If the criteria is the same as the last
  655. // one, just return the collection.
  656. $criteria->add(KataoAssocMemberGroupPeer::GROUP_ID, $this->getId());
  657. if (!isset($this->lastKataoAssocMemberGroupCriteria) || !$this->lastKataoAssocMemberGroupCriteria->equals($criteria)) {
  658. $this->collKataoAssocMemberGroups = KataoAssocMemberGroupPeer::doSelectJoinKataoMember($criteria, $con);
  659. }
  660. }
  661. $this->lastKataoAssocMemberGroupCriteria = $criteria;
  662. return $this->collKataoAssocMemberGroups;
  663. }
  664. public function __call($method, $arguments)
  665. {
  666. if (!$callable = sfMixer::getCallable('BaseKataoMemberGroup:'.$method))
  667. {
  668. throw new sfException(sprintf('Call to undefined method BaseKataoMemberGroup::%s', $method));
  669. }
  670. array_unshift($arguments, $this);
  671. return call_user_func_array($callable, $arguments);
  672. }
  673. } // BaseKataoMemberGroup