       1: <?php
       2:
       3: namespace Thelia\Model\om;
       4:
       5: use \BaseObject;
       6: use \BasePeer;
       7: use \Criteria;
       8: use \DateTime;
       9: use \Exception;
      10: use \PDO;
      11: use \Persistent;
      12: use \Propel;
      13: use \PropelCollection;
      14: use \PropelDateTime;
      15: use \PropelException;
      16: use \PropelObjectCollection;
      17: use \PropelPDO;
      18: use Thelia\Model\GroupModule;
      19: use Thelia\Model\GroupModuleQuery;
      20: use Thelia\Model\Module;
      21: use Thelia\Model\ModuleI18n;
      22: use Thelia\Model\ModuleI18nQuery;
      23: use Thelia\Model\ModulePeer;
      24: use Thelia\Model\ModuleQuery;
      25:
      26: /**
      27:  * Base class that represents a row from the 'module' table.
      28:  *
      29:  *
      30:  *
      31:  * @package    propel.generator.Thelia.Model.om
      32:  */
      33: abstract class BaseModule extends BaseObject implements Persistent
      34: {
      35:     /**
      36:      * Peer class name
      37:      */
      38:     const PEER = 'Thelia\\Model\\ModulePeer';
      39:
      40:     /**
      41:      * The Peer class.
      42:      * Instance provides a convenient way of calling static methods on a class
      43:      * that calling code may not be able to identify.
      44:      * @var        ModulePeer
      45:      */
      46:     protected static $peer;
      47:
      48:     /**
      49:      * The flag var to prevent infinit loop in deep copy
      50:      * @var       boolean
      51:      */
      52:     protected $startCopy = false;
      53:
      54:     /**
      55:      * The value for the id field.
      56:      * @var        int
      57:      */
      58:     protected $id;
      59:
      60:     /**
      61:      * The value for the code field.
      62:      * @var        string
      63:      */
      64:     protected $code;
      65:
      66:     /**
      67:      * The value for the type field.
      68:      * @var        int
      69:      */
      70:     protected $type;
      71:
      72:     /**
      73:      * The value for the activate field.
      74:      * @var        int
      75:      */
      76:     protected $activate;
      77:
      78:     /**
      79:      * The value for the position field.
      80:      * @var        int
      81:      */
      82:     protected $position;
      83:
      84:     /**
      85:      * The value for the created_at field.
      86:      * @var        string
      87:      */
      88:     protected $created_at;
      89:
      90:     /**
      91:      * The value for the updated_at field.
      92:      * @var        string
      93:      */
      94:     protected $updated_at;
      95:
      96:     /**
      97:      * @var        PropelObjectCollection|GroupModule[] Collection to store aggregation of GroupModule objects.
      98:      */
      99:     protected $collGroupModules;
     100:     protected $collGroupModulesPartial;
     101:
     102:     /**
     103:      * @var        PropelObjectCollection|ModuleI18n[] Collection to store aggregation of ModuleI18n objects.
     104:      */
     105:     protected $collModuleI18ns;
     106:     protected $collModuleI18nsPartial;
     107:
     108:     /**
     109:      * Flag to prevent endless save loop, if this object is referenced
     110:      * by another object which falls in this transaction.
     111:      * @var        boolean
     112:      */
     113:     protected $alreadyInSave = false;
     114:
     115:     /**
     116:      * Flag to prevent endless validation loop, if this object is referenced
     117:      * by another object which falls in this transaction.
     118:      * @var        boolean
     119:      */
     120:     protected $alreadyInValidation = false;
     121:
     122:     /**
     123:      * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
     124:      * @var        boolean
     125:      */
     126:     protected $alreadyInClearAllReferencesDeep = false;
     127:
     128:     // i18n behavior
     129:
     130:     /**
     131:      * Current locale
     132:      * @var        string
     133:      */
     134:     protected $currentLocale = 'en_US';
     135:
     136:     /**
     137:      * Current translation objects
     138:      * @var        array[ModuleI18n]
     139:      */
     140:     protected $currentTranslations;
     141:
     142:     /**
     143:      * An array of objects scheduled for deletion.
     144:      * @var     PropelObjectCollection
     145:      */
     146:     protected $groupModulesScheduledForDeletion = null;
     147:
     148:     /**
     149:      * An array of objects scheduled for deletion.
     150:      * @var     PropelObjectCollection
     151:      */
     152:     protected $moduleI18nsScheduledForDeletion = null;
     153:
     154:     /**
     155:      * Get the [id] column value.
     156:      *
     157:      * @return int
     158:      */
     159:     public function getId()
     160:     {
     161:         return $this->id;
     162:     }
     163:
     164:     /**
     165:      * Get the [code] column value.
     166:      *
     167:      * @return string
     168:      */
     169:     public function getCode()
     170:     {
     171:         return $this->code;
     172:     }
     173:
     174:     /**
     175:      * Get the [type] column value.
     176:      *
     177:      * @return int
     178:      */
     179:     public function getType()
     180:     {
     181:         return $this->type;
     182:     }
     183:
     184:     /**
     185:      * Get the [activate] column value.
     186:      *
     187:      * @return int
     188:      */
     189:     public function getActivate()
     190:     {
     191:         return $this->activate;
     192:     }
     193:
     194:     /**
     195:      * Get the [position] column value.
     196:      *
     197:      * @return int
     198:      */
     199:     public function getPosition()
     200:     {
     201:         return $this->position;
     202:     }
     203:
     204:     /**
     205:      * Get the [optionally formatted] temporal [created_at] column value.
     206:      *
     207:      *
     208:      * @param string $format The date/time format string (either date()-style or strftime()-style).
     209:      *               If format is null, then the raw DateTime object will be returned.
     210:      * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00
     211:      * @throws PropelException - if unable to parse/validate the date/time value.
     212:      */
     213:     public function getCreatedAt($format = 'Y-m-d H:i:s')
     214:     {
     215:         if ($this->created_at === null) {
     216:             return null;
     217:         }
     218:
     219:         if ($this->created_at === '0000-00-00 00:00:00') {
     220:             // while technically this is not a default value of null,
     221:             // this seems to be closest in meaning.
     222:             return null;
     223:         }
     224:
     225:         try {
     226:             $dt = new DateTime($this->created_at);
     227:         } catch (Exception $x) {
     228:             throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created_at, true), $x);
     229:         }
     230:
     231:         if ($format === null) {
     232:             // Because propel.useDateTimeClass is true, we return a DateTime object.
     233:             return $dt;
     234:         }
     235:
     236:         if (strpos($format, '%') !== false) {
     237:             return strftime($format, $dt->format('U'));
     238:         }
     239:
     240:         return $dt->format($format);
     241:
     242:     }
     243:
     244:     /**
     245:      * Get the [optionally formatted] temporal [updated_at] column value.
     246:      *
     247:      *
     248:      * @param string $format The date/time format string (either date()-style or strftime()-style).
     249:      *               If format is null, then the raw DateTime object will be returned.
     250:      * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null, and 0 if column value is 0000-00-00 00:00:00
     251:      * @throws PropelException - if unable to parse/validate the date/time value.
     252:      */
     253:     public function getUpdatedAt($format = 'Y-m-d H:i:s')
     254:     {
     255:         if ($this->updated_at === null) {
     256:             return null;
     257:         }
     258:
     259:         if ($this->updated_at === '0000-00-00 00:00:00') {
     260:             // while technically this is not a default value of null,
     261:             // this seems to be closest in meaning.
     262:             return null;
     263:         }
     264:
     265:         try {
     266:             $dt = new DateTime($this->updated_at);
     267:         } catch (Exception $x) {
     268:             throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->updated_at, true), $x);
     269:         }
     270:
     271:         if ($format === null) {
     272:             // Because propel.useDateTimeClass is true, we return a DateTime object.
     273:             return $dt;
     274:         }
     275:
     276:         if (strpos($format, '%') !== false) {
     277:             return strftime($format, $dt->format('U'));
     278:         }
     279:
     280:         return $dt->format($format);
     281:
     282:     }
     283:
     284:     /**
     285:      * Set the value of [id] column.
     286:      *
     287:      * @param int $v new value
     288:      * @return Module The current object (for fluent API support)
     289:      */
     290:     public function setId($v)
     291:     {
     292:         if ($v !== null && is_numeric($v)) {
     293:             $v = (int) $v;
     294:         }
     295:
     296:         if ($this->id !== $v) {
     297:             $this->id = $v;
     298:             $this->modifiedColumns[] = ModulePeer::ID;
     299:         }
     300:
     301:
     302:         return $this;
     303:     } // setId()
     304:
     305:     /**
     306:      * Set the value of [code] column.
     307:      *
     308:      * @param string $v new value
     309:      * @return Module The current object (for fluent API support)
     310:      */
     311:     public function setCode($v)
     312:     {
     313:         if ($v !== null && is_numeric($v)) {
     314:             $v = (string) $v;
     315:         }
     316:
     317:         if ($this->code !== $v) {
     318:             $this->code = $v;
     319:             $this->modifiedColumns[] = ModulePeer::CODE;
     320:         }
     321:
     322:
     323:         return $this;
     324:     } // setCode()
     325:
     326:     /**
     327:      * Set the value of [type] column.
     328:      *
     329:      * @param int $v new value
     330:      * @return Module The current object (for fluent API support)
     331:      */
     332:     public function setType($v)
     333:     {
     334:         if ($v !== null && is_numeric($v)) {
     335:             $v = (int) $v;
     336:         }
     337:
     338:         if ($this->type !== $v) {
     339:             $this->type = $v;
     340:             $this->modifiedColumns[] = ModulePeer::TYPE;
     341:         }
     342:
     343:
     344:         return $this;
     345:     } // setType()
     346:
     347:     /**
     348:      * Set the value of [activate] column.
     349:      *
     350:      * @param int $v new value
     351:      * @return Module The current object (for fluent API support)
     352:      */
     353:     public function setActivate($v)
     354:     {
     355:         if ($v !== null && is_numeric($v)) {
     356:             $v = (int) $v;
     357:         }
     358:
     359:         if ($this->activate !== $v) {
     360:             $this->activate = $v;
     361:             $this->modifiedColumns[] = ModulePeer::ACTIVATE;
     362:         }
     363:
     364:
     365:         return $this;
     366:     } // setActivate()
     367:
     368:     /**
     369:      * Set the value of [position] column.
     370:      *
     371:      * @param int $v new value
     372:      * @return Module The current object (for fluent API support)
     373:      */
     374:     public function setPosition($v)
     375:     {
     376:         if ($v !== null && is_numeric($v)) {
     377:             $v = (int) $v;
     378:         }
     379:
     380:         if ($this->position !== $v) {
     381:             $this->position = $v;
     382:             $this->modifiedColumns[] = ModulePeer::POSITION;
     383:         }
     384:
     385:
     386:         return $this;
     387:     } // setPosition()
     388:
     389:     /**
     390:      * Sets the value of [created_at] column to a normalized version of the date/time value specified.
     391:      *
     392:      * @param mixed $v string, integer (timestamp), or DateTime value.
     393:      *               Empty strings are treated as null.
     394:      * @return Module The current object (for fluent API support)
     395:      */
     396:     public function setCreatedAt($v)
     397:     {
     398:         $dt = PropelDateTime::newInstance($v, null, 'DateTime');
     399:         if ($this->created_at !== null || $dt !== null) {
     400:             $currentDateAsString = ($this->created_at !== null && $tmpDt = new DateTime($this->created_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
     401:             $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
     402:             if ($currentDateAsString !== $newDateAsString) {
     403:                 $this->created_at = $newDateAsString;
     404:                 $this->modifiedColumns[] = ModulePeer::CREATED_AT;
     405:             }
     406:         } // if either are not null
     407:
     408:
     409:         return $this;
     410:     } // setCreatedAt()
     411:
     412:     /**
     413:      * Sets the value of [updated_at] column to a normalized version of the date/time value specified.
     414:      *
     415:      * @param mixed $v string, integer (timestamp), or DateTime value.
     416:      *               Empty strings are treated as null.
     417:      * @return Module The current object (for fluent API support)
     418:      */
     419:     public function setUpdatedAt($v)
     420:     {
     421:         $dt = PropelDateTime::newInstance($v, null, 'DateTime');
     422:         if ($this->updated_at !== null || $dt !== null) {
     423:             $currentDateAsString = ($this->updated_at !== null && $tmpDt = new DateTime($this->updated_at)) ? $tmpDt->format('Y-m-d H:i:s') : null;
     424:             $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
     425:             if ($currentDateAsString !== $newDateAsString) {
     426:                 $this->updated_at = $newDateAsString;
     427:                 $this->modifiedColumns[] = ModulePeer::UPDATED_AT;
     428:             }
     429:         } // if either are not null
     430:
     431:
     432:         return $this;
     433:     } // setUpdatedAt()
     434:
     435:     /**
     436:      * Indicates whether the columns in this object are only set to default values.
     437:      *
     438:      * This method can be used in conjunction with isModified() to indicate whether an object is both
     439:      * modified _and_ has some values set which are non-default.
     440:      *
     441:      * @return boolean Whether the columns in this object are only been set with default values.
     442:      */
     443:     public function hasOnlyDefaultValues()
     444:     {
     445:         // otherwise, everything was equal, so return true
     446:         return true;
     447:     } // hasOnlyDefaultValues()
     448:
     449:     /**
     450:      * Hydrates (populates) the object variables with values from the database resultset.
     451:      *
     452:      * An offset (0-based "start column") is specified so that objects can be hydrated
     453:      * with a subset of the columns in the resultset rows.  This is needed, for example,
     454:      * for results of JOIN queries where the resultset row includes columns from two or
     455:      * more tables.
     456:      *
     457:      * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
     458:      * @param int $startcol 0-based offset column which indicates which restultset column to start with.
     459:      * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
     460:      * @return int             next starting column
     461:      * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
     462:      */
     463:     public function hydrate($row, $startcol = 0, $rehydrate = false)
     464:     {
     465:         try {
     466:
     467:             $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
     468:             $this->code = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
     469:             $this->type = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
     470:             $this->activate = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
     471:             $this->position = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
     472:             $this->created_at = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
     473:             $this->updated_at = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
     474:             $this->resetModified();
     475:
     476:             $this->setNew(false);
     477:
     478:             if ($rehydrate) {
     479:                 $this->ensureConsistency();
     480:             }
     481:             $this->postHydrate($row, $startcol, $rehydrate);
     482:             return $startcol + 7; // 7 = ModulePeer::NUM_HYDRATE_COLUMNS.
     483:
     484:         } catch (Exception $e) {
     485:             throw new PropelException("Error populating Module object", $e);
     486:         }
     487:     }
     488:
     489:     /**
     490:      * Checks and repairs the internal consistency of the object.
     491:      *
     492:      * This method is executed after an already-instantiated object is re-hydrated
     493:      * from the database.  It exists to check any foreign keys to make sure that
     494:      * the objects related to the current object are correct based on foreign key.
     495:      *
     496:      * You can override this method in the stub class, but you should always invoke
     497:      * the base method from the overridden method (i.e. parent::ensureConsistency()),
     498:      * in case your model changes.
     499:      *
     500:      * @throws PropelException
     501:      */
     502:     public function ensureConsistency()
     503:     {
     504:
     505:     } // ensureConsistency
     506:
     507:     /**
     508:      * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
     509:      *
     510:      * This will only work if the object has been saved and has a valid primary key set.
     511:      *
     512:      * @param boolean $deep (optional) Whether to also de-associated any related objects.
     513:      * @param PropelPDO $con (optional) The PropelPDO connection to use.
     514:      * @return void
     515:      * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
     516:      */
     517:     public function reload($deep = false, PropelPDO $con = null)
     518:     {
     519:         if ($this->isDeleted()) {
     520:             throw new PropelException("Cannot reload a deleted object.");
     521:         }
     522:
     523:         if ($this->isNew()) {
     524:             throw new PropelException("Cannot reload an unsaved object.");
     525:         }
     526:
     527:         if ($con === null) {
     528:             $con = Propel::getConnection(ModulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
     529:         }
     530:
     531:         // We don't need to alter the object instance pool; we're just modifying this instance
     532:         // already in the pool.
     533:
     534:         $stmt = ModulePeer::doSelectStmt($this->buildPkeyCriteria(), $con);
     535:         $row = $stmt->fetch(PDO::FETCH_NUM);
     536:         $stmt->closeCursor();
     537:         if (!$row) {
     538:             throw new PropelException('Cannot find matching row in the database to reload object values.');
     539:         }
     540:         $this->hydrate($row, 0, true); // rehydrate
     541:
     542:         if ($deep) {  // also de-associate any related objects?
     543:
     544:             $this->collGroupModules = null;
     545:
     546:             $this->collModuleI18ns = null;
     547:
     548:         } // if (deep)
     549:     }
     550:
     551:     /**
     552:      * Removes this object from datastore and sets delete attribute.
     553:      *
     554:      * @param PropelPDO $con
     555:      * @return void
     556:      * @throws PropelException
     557:      * @throws Exception
     558:      * @see        BaseObject::setDeleted()
     559:      * @see        BaseObject::isDeleted()
     560:      */
     561:     public function delete(PropelPDO $con = null)
     562:     {
     563:         if ($this->isDeleted()) {
     564:             throw new PropelException("This object has already been deleted.");
     565:         }
     566:
     567:         if ($con === null) {
     568:             $con = Propel::getConnection(ModulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     569:         }
     570:
     571:         $con->beginTransaction();
     572:         try {
     573:             $deleteQuery = ModuleQuery::create()
     574:                 ->filterByPrimaryKey($this->getPrimaryKey());
     575:             $ret = $this->preDelete($con);
     576:             if ($ret) {
     577:                 $deleteQuery->delete($con);
     578:                 $this->postDelete($con);
     579:                 $con->commit();
     580:                 $this->setDeleted(true);
     581:             } else {
     582:                 $con->commit();
     583:             }
     584:         } catch (Exception $e) {
     585:             $con->rollBack();
     586:             throw $e;
     587:         }
     588:     }
     589:
     590:     /**
     591:      * Persists this object to the database.
     592:      *
     593:      * If the object is new, it inserts it; otherwise an update is performed.
     594:      * All modified related objects will also be persisted in the doSave()
     595:      * method.  This method wraps all precipitate database operations in a
     596:      * single transaction.
     597:      *
     598:      * @param PropelPDO $con
     599:      * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
     600:      * @throws PropelException
     601:      * @throws Exception
     602:      * @see        doSave()
     603:      */
     604:     public function save(PropelPDO $con = null)
     605:     {
     606:         if ($this->isDeleted()) {
     607:             throw new PropelException("You cannot save an object that has been deleted.");
     608:         }
     609:
     610:         if ($con === null) {
     611:             $con = Propel::getConnection(ModulePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     612:         }
     613:
     614:         $con->beginTransaction();
     615:         $isInsert = $this->isNew();
     616:         try {
     617:             $ret = $this->preSave($con);
     618:             if ($isInsert) {
     619:                 $ret = $ret && $this->preInsert($con);
     620:                 // timestampable behavior
     621:                 if (!$this->isColumnModified(ModulePeer::CREATED_AT)) {
     622:                     $this->setCreatedAt(time());
     623:                 }
     624:                 if (!$this->isColumnModified(ModulePeer::UPDATED_AT)) {
     625:                     $this->setUpdatedAt(time());
     626:                 }
     627:             } else {
     628:                 $ret = $ret && $this->preUpdate($con);
     629:                 // timestampable behavior
     630:                 if ($this->isModified() && !$this->isColumnModified(ModulePeer::UPDATED_AT)) {
     631:                     $this->setUpdatedAt(time());
     632:                 }
     633:             }
     634:             if ($ret) {
     635:                 $affectedRows = $this->doSave($con);
     636:                 if ($isInsert) {
     637:                     $this->postInsert($con);
     638:                 } else {
     639:                     $this->postUpdate($con);
     640:                 }
     641:                 $this->postSave($con);
     642:                 ModulePeer::addInstanceToPool($this);
     643:             } else {
     644:                 $affectedRows = 0;
     645:             }
     646:             $con->commit();
     647:
     648:             return $affectedRows;
     649:         } catch (Exception $e) {
     650:             $con->rollBack();
     651:             throw $e;
     652:         }
     653:     }
     654:
     655:     /**
     656:      * Performs the work of inserting or updating the row in the database.
     657:      *
     658:      * If the object is new, it inserts it; otherwise an update is performed.
     659:      * All related objects are also updated in this method.
     660:      *
     661:      * @param PropelPDO $con
     662:      * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
     663:      * @throws PropelException
     664:      * @see        save()
     665:      */
     666:     protected function doSave(PropelPDO $con)
     667:     {
     668:         $affectedRows = 0; // initialize var to track total num of affected rows
     669:         if (!$this->alreadyInSave) {
     670:             $this->alreadyInSave = true;
     671:
     672:             if ($this->isNew() || $this->isModified()) {
     673:                 // persist changes
     674:                 if ($this->isNew()) {
     675:                     $this->doInsert($con);
     676:                 } else {
     677:                     $this->doUpdate($con);
     678:                 }
     679:                 $affectedRows += 1;
     680:                 $this->resetModified();
     681:             }
     682:
     683:             if ($this->groupModulesScheduledForDeletion !== null) {
     684:                 if (!$this->groupModulesScheduledForDeletion->isEmpty()) {
     685:                     foreach ($this->groupModulesScheduledForDeletion as $groupModule) {
     686:                         // need to save related object because we set the relation to null
     687:                         $groupModule->save($con);
     688:                     }
     689:                     $this->groupModulesScheduledForDeletion = null;
     690:                 }
     691:             }
     692:
     693:             if ($this->collGroupModules !== null) {
     694:                 foreach ($this->collGroupModules as $referrerFK) {
     695:                     if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
     696:                         $affectedRows += $referrerFK->save($con);
     697:                     }
     698:                 }
     699:             }
     700:
     701:             if ($this->moduleI18nsScheduledForDeletion !== null) {
     702:                 if (!$this->moduleI18nsScheduledForDeletion->isEmpty()) {
     703:                     ModuleI18nQuery::create()
     704:                         ->filterByPrimaryKeys($this->moduleI18nsScheduledForDeletion->getPrimaryKeys(false))
     705:                         ->delete($con);
     706:                     $this->moduleI18nsScheduledForDeletion = null;
     707:                 }
     708:             }
     709:
     710:             if ($this->collModuleI18ns !== null) {
     711:                 foreach ($this->collModuleI18ns as $referrerFK) {
     712:                     if (!$referrerFK->isDeleted() && ($referrerFK->isNew() || $referrerFK->isModified())) {
     713:                         $affectedRows += $referrerFK->save($con);
     714:                     }
     715:                 }
     716:             }
     717:
     718:             $this->alreadyInSave = false;
     719:
     720:         }
     721:
     722:         return $affectedRows;
     723:     } // doSave()
     724:
     725:     /**
     726:      * Insert the row in the database.
     727:      *
     728:      * @param PropelPDO $con
     729:      *
     730:      * @throws PropelException
     731:      * @see        doSave()
     732:      */
     733:     protected function doInsert(PropelPDO $con)
     734:     {
     735:         $modifiedColumns = array();
     736:         $index = 0;
     737:
     738:         $this->modifiedColumns[] = ModulePeer::ID;
     739:         if (null !== $this->id) {
     740:             throw new PropelException('Cannot insert a value for auto-increment primary key (' . ModulePeer::ID . ')');
     741:         }
     742:
     743:          // check the columns in natural order for more readable SQL queries
     744:         if ($this->isColumnModified(ModulePeer::ID)) {
     745:             $modifiedColumns[':p' . $index++]  = '`id`';
     746:         }
     747:         if ($this->isColumnModified(ModulePeer::CODE)) {
     748:             $modifiedColumns[':p' . $index++]  = '`code`';
     749:         }
     750:         if ($this->isColumnModified(ModulePeer::TYPE)) {
     751:             $modifiedColumns[':p' . $index++]  = '`type`';
     752:         }
     753:         if ($this->isColumnModified(ModulePeer::ACTIVATE)) {
     754:             $modifiedColumns[':p' . $index++]  = '`activate`';
     755:         }
     756:         if ($this->isColumnModified(ModulePeer::POSITION)) {
     757:             $modifiedColumns[':p' . $index++]  = '`position`';
     758:         }
     759:         if ($this->isColumnModified(ModulePeer::CREATED_AT)) {
     760:             $modifiedColumns[':p' . $index++]  = '`created_at`';
     761:         }
     762:         if ($this->isColumnModified(ModulePeer::UPDATED_AT)) {
     763:             $modifiedColumns[':p' . $index++]  = '`updated_at`';
     764:         }
     765:
     766:         $sql = sprintf(
     767:             'INSERT INTO `module` (%s) VALUES (%s)',
     768:             implode(', ', $modifiedColumns),
     769:             implode(', ', array_keys($modifiedColumns))
     770:         );
     771:
     772:         try {
     773:             $stmt = $con->prepare($sql);
     774:             foreach ($modifiedColumns as $identifier => $columnName) {
     775:                 switch ($columnName) {
     776:                     case '`id`':
     777:                         $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
     778:                         break;
     779:                     case '`code`':
     780:                         $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR);
     781:                         break;
     782:                     case '`type`':
     783:                         $stmt->bindValue($identifier, $this->type, PDO::PARAM_INT);
     784:                         break;
     785:                     case '`activate`':
     786:                         $stmt->bindValue($identifier, $this->activate, PDO::PARAM_INT);
     787:                         break;
     788:                     case '`position`':
     789:                         $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT);
     790:                         break;
     791:                     case '`created_at`':
     792:                         $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR);
     793:                         break;
     794:                     case '`updated_at`':
     795:                         $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
     796:                         break;
     797:                 }
     798:             }
     799:             $stmt->execute();
     800:         } catch (Exception $e) {
     801:             Propel::log($e->getMessage(), Propel::LOG_ERR);
     802:             throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
     803:         }
     804:
     805:         try {
     806:             $pk = $con->lastInsertId();
     807:         } catch (Exception $e) {
     808:             throw new PropelException('Unable to get autoincrement id.', $e);
     809:         }
     810:         $this->setId($pk);
     811:
     812:         $this->setNew(false);
     813:     }
     814:
     815:     /**
     816:      * Update the row in the database.
     817:      *
     818:      * @param PropelPDO $con
     819:      *
     820:      * @see        doSave()
     821:      */
     822:     protected function doUpdate(PropelPDO $con)
     823:     {
     824:         $selectCriteria = $this->buildPkeyCriteria();
     825:         $valuesCriteria = $this->buildCriteria();
     826:         BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
     827:     }
     828:
     829:     /**
     830:      * Array of ValidationFailed objects.
     831:      * @var        array ValidationFailed[]
     832:      */
     833:     protected $validationFailures = array();
     834:
     835:     /**
     836:      * Gets any ValidationFailed objects that resulted from last call to validate().
     837:      *
     838:      *
     839:      * @return array ValidationFailed[]
     840:      * @see        validate()
     841:      */
     842:     public function getValidationFailures()
     843:     {
     844:         return $this->validationFailures;
     845:     }
     846:
     847:     /**
     848:      * Validates the objects modified field values and all objects related to this table.
     849:      *
     850:      * If $columns is either a column name or an array of column names
     851:      * only those columns are validated.
     852:      *
     853:      * @param mixed $columns Column name or an array of column names.
     854:      * @return boolean Whether all columns pass validation.
     855:      * @see        doValidate()
     856:      * @see        getValidationFailures()
     857:      */
     858:     public function validate($columns = null)
     859:     {
     860:         $res = $this->doValidate($columns);
     861:         if ($res === true) {
     862:             $this->validationFailures = array();
     863:
     864:             return true;
     865:         }
     866:
     867:         $this->validationFailures = $res;
     868:
     869:         return false;
     870:     }
     871:
     872:     /**
     873:      * This function performs the validation work for complex object models.
     874:      *
     875:      * In addition to checking the current object, all related objects will
     876:      * also be validated.  If all pass then <code>true</code> is returned; otherwise
     877:      * an aggreagated array of ValidationFailed objects will be returned.
     878:      *
     879:      * @param array $columns Array of column names to validate.
     880:      * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
     881:      */
     882:     protected function doValidate($columns = null)
     883:     {
     884:         if (!$this->alreadyInValidation) {
     885:             $this->alreadyInValidation = true;
     886:             $retval = null;
     887:
     888:             $failureMap = array();
     889:
     890:
     891:             if (($retval = ModulePeer::doValidate($this, $columns)) !== true) {
     892:                 $failureMap = array_merge($failureMap, $retval);
     893:             }
     894:
     895:
     896:                 if ($this->collGroupModules !== null) {
     897:                     foreach ($this->collGroupModules as $referrerFK) {
     898:                         if (!$referrerFK->validate($columns)) {
     899:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
     900:                         }
     901:                     }
     902:                 }
     903:
     904:                 if ($this->collModuleI18ns !== null) {
     905:                     foreach ($this->collModuleI18ns as $referrerFK) {
     906:                         if (!$referrerFK->validate($columns)) {
     907:                             $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
     908:                         }
     909:                     }
     910:                 }
     911:
     912:
     913:             $this->alreadyInValidation = false;
     914:         }
     915:
     916:         return (!empty($failureMap) ? $failureMap : true);
     917:     }
     918:
     919:     /**
     920:      * Retrieves a field from the object by name passed in as a string.
     921:      *
     922:      * @param string $name name
     923:      * @param string $type The type of fieldname the $name is of:
     924:      *               one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
     925:      *               BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
     926:      *               Defaults to BasePeer::TYPE_PHPNAME
     927:      * @return mixed Value of field.
     928:      */
     929:     public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
     930:     {
     931:         $pos = ModulePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
     932:         $field = $this->getByPosition($pos);
     933:
     934:         return $field;
     935:     }
     936:
     937:     /**
     938:      * Retrieves a field from the object by Position as specified in the xml schema.
     939:      * Zero-based.
     940:      *
     941:      * @param int $pos position in xml schema
     942:      * @return mixed Value of field at $pos
     943:      */
     944:     public function getByPosition($pos)
     945:     {
     946:         switch ($pos) {
     947:             case 0:
     948:                 return $this->getId();
     949:                 break;
     950:             case 1:
     951:                 return $this->getCode();
     952:                 break;
     953:             case 2:
     954:                 return $this->getType();
     955:                 break;
     956:             case 3:
     957:                 return $this->getActivate();
     958:                 break;
     959:             case 4:
     960:                 return $this->getPosition();
     961:                 break;
     962:             case 5:
     963:                 return $this->getCreatedAt();
     964:                 break;
     965:             case 6:
     966:                 return $this->getUpdatedAt();
     967:                 break;
     968:             default:
     969:                 return null;
     970:                 break;
     971:         } // switch()
     972:     }
     973:
     974:     /**
     975:      * Exports the object as an array.
     976:      *
     977:      * You can specify the key type of the array by passing one of the class
     978:      * type constants.
     979:      *
     980:      * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
     981:      *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
     982:      *                    Defaults to BasePeer::TYPE_PHPNAME.
     983:      * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
     984:      * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
     985:      * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
     986:      *
     987:      * @return array an associative array containing the field names (as keys) and field values
     988:      */
     989:     public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
     990:     {
     991:         if (isset($alreadyDumpedObjects['Module'][$this->getPrimaryKey()])) {
     992:             return '*RECURSION*';
     993:         }
     994:         $alreadyDumpedObjects['Module'][$this->getPrimaryKey()] = true;
     995:         $keys = ModulePeer::getFieldNames($keyType);
     996:         $result = array(
     997:             $keys[0] => $this->getId(),
     998:             $keys[1] => $this->getCode(),
     999:             $keys[2] => $this->getType(),
    1000:             $keys[3] => $this->getActivate(),
    1001:             $keys[4] => $this->getPosition(),
    1002:             $keys[5] => $this->getCreatedAt(),
    1003:             $keys[6] => $this->getUpdatedAt(),
    1004:         );
    1005:         if ($includeForeignObjects) {
    1006:             if (null !== $this->collGroupModules) {
    1007:                 $result['GroupModules'] = $this->collGroupModules->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
    1008:             }
    1009:             if (null !== $this->collModuleI18ns) {
    1010:                 $result['ModuleI18ns'] = $this->collModuleI18ns->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
    1011:             }
    1012:         }
    1013:
    1014:         return $result;
    1015:     }
    1016:
    1017:     /**
    1018:      * Sets a field from the object by name passed in as a string.
    1019:      *
    1020:      * @param string $name peer name
    1021:      * @param mixed $value field value
    1022:      * @param string $type The type of fieldname the $name is of:
    1023:      *                     one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
    1024:      *                     BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
    1025:      *                     Defaults to BasePeer::TYPE_PHPNAME
    1026:      * @return void
    1027:      */
    1028:     public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
    1029:     {
    1030:         $pos = ModulePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
    1031:
    1032:         $this->setByPosition($pos, $value);
    1033:     }
    1034:
    1035:     /**
    1036:      * Sets a field from the object by Position as specified in the xml schema.
    1037:      * Zero-based.
    1038:      *
    1039:      * @param int $pos position in xml schema
    1040:      * @param mixed $value field value
    1041:      * @return void
    1042:      */
    1043:     public function setByPosition($pos, $value)
    1044:     {
    1045:         switch ($pos) {
    1046:             case 0:
    1047:                 $this->setId($value);
    1048:                 break;
    1049:             case 1:
    1050:                 $this->setCode($value);
    1051:                 break;
    1052:             case 2:
    1053:                 $this->setType($value);
    1054:                 break;
    1055:             case 3:
    1056:                 $this->setActivate($value);
    1057:                 break;
    1058:             case 4:
    1059:                 $this->setPosition($value);
    1060:                 break;
    1061:             case 5:
    1062:                 $this->setCreatedAt($value);
    1063:                 break;
    1064:             case 6:
    1065:                 $this->setUpdatedAt($value);
    1066:                 break;
    1067:         } // switch()
    1068:     }
    1069:
    1070:     /**
    1071:      * Populates the object using an array.
    1072:      *
    1073:      * This is particularly useful when populating an object from one of the
    1074:      * request arrays (e.g. $_POST).  This method goes through the column
    1075:      * names, checking to see whether a matching key exists in populated
    1076:      * array. If so the setByName() method is called for that column.
    1077:      *
    1078:      * You can specify the key type of the array by additionally passing one
    1079:      * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
    1080:      * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
    1081:      * The default key type is the column's BasePeer::TYPE_PHPNAME
    1082:      *
    1083:      * @param array  $arr     An array to populate the object from.
    1084:      * @param string $keyType The type of keys the array uses.
    1085:      * @return void
    1086:      */
    1087:     public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
    1088:     {
    1089:         $keys = ModulePeer::getFieldNames($keyType);
    1090:
    1091:         if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
    1092:         if (array_key_exists($keys[1], $arr)) $this->setCode($arr[$keys[1]]);
    1093:         if (array_key_exists($keys[2], $arr)) $this->setType($arr[$keys[2]]);
    1094:         if (array_key_exists($keys[3], $arr)) $this->setActivate($arr[$keys[3]]);
    1095:         if (array_key_exists($keys[4], $arr)) $this->setPosition($arr[$keys[4]]);
    1096:         if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
    1097:         if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
    1098:     }
    1099:
    1100:     /**
    1101:      * Build a Criteria object containing the values of all modified columns in this object.
    1102:      *
    1103:      * @return Criteria The Criteria object containing all modified values.
    1104:      */
    1105:     public function buildCriteria()
    1106:     {
    1107:         $criteria = new Criteria(ModulePeer::DATABASE_NAME);
    1108:
    1109:         if ($this->isColumnModified(ModulePeer::ID)) $criteria->add(ModulePeer::ID, $this->id);
    1110:         if ($this->isColumnModified(ModulePeer::CODE)) $criteria->add(ModulePeer::CODE, $this->code);
    1111:         if ($this->isColumnModified(ModulePeer::TYPE)) $criteria->add(ModulePeer::TYPE, $this->type);
    1112:         if ($this->isColumnModified(ModulePeer::ACTIVATE)) $criteria->add(ModulePeer::ACTIVATE, $this->activate);
    1113:         if ($this->isColumnModified(ModulePeer::POSITION)) $criteria->add(ModulePeer::POSITION, $this->position);
    1114:         if ($this->isColumnModified(ModulePeer::CREATED_AT)) $criteria->add(ModulePeer::CREATED_AT, $this->created_at);
    1115:         if ($this->isColumnModified(ModulePeer::UPDATED_AT)) $criteria->add(ModulePeer::UPDATED_AT, $this->updated_at);
    1116:
    1117:         return $criteria;
    1118:     }
    1119:
    1120:     /**
    1121:      * Builds a Criteria object containing the primary key for this object.
    1122:      *
    1123:      * Unlike buildCriteria() this method includes the primary key values regardless
    1124:      * of whether or not they have been modified.
    1125:      *
    1126:      * @return Criteria The Criteria object containing value(s) for primary key(s).
    1127:      */
    1128:     public function buildPkeyCriteria()
    1129:     {
    1130:         $criteria = new Criteria(ModulePeer::DATABASE_NAME);
    1131:         $criteria->add(ModulePeer::ID, $this->id);
    1132:
    1133:         return $criteria;
    1134:     }
    1135:
    1136:     /**
    1137:      * Returns the primary key for this object (row).
    1138:      * @return int
    1139:      */
    1140:     public function getPrimaryKey()
    1141:     {
    1142:         return $this->getId();
    1143:     }
    1144:
    1145:     /**
    1146:      * Generic method to set the primary key (id column).
    1147:      *
    1148:      * @param  int $key Primary key.
    1149:      * @return void
    1150:      */
    1151:     public function setPrimaryKey($key)
    1152:     {
    1153:         $this->setId($key);
    1154:     }
    1155:
    1156:     /**
    1157:      * Returns true if the primary key for this object is null.
    1158:      * @return boolean
    1159:      */
    1160:     public function isPrimaryKeyNull()
    1161:     {
    1162:
    1163:         return null === $this->getId();
    1164:     }
    1165:
    1166:     /**
    1167:      * Sets contents of passed object to values from current object.
    1168:      *
    1169:      * If desired, this method can also make copies of all associated (fkey referrers)
    1170:      * objects.
    1171:      *
    1172:      * @param object $copyObj An object of Module (or compatible) type.
    1173:      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
    1174:      * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
    1175:      * @throws PropelException
    1176:      */
    1177:     public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
    1178:     {
    1179:         $copyObj->setCode($this->getCode());
    1180:         $copyObj->setType($this->getType());
    1181:         $copyObj->setActivate($this->getActivate());
    1182:         $copyObj->setPosition($this->getPosition());
    1183:         $copyObj->setCreatedAt($this->getCreatedAt());
    1184:         $copyObj->setUpdatedAt($this->getUpdatedAt());
    1185:
    1186:         if ($deepCopy && !$this->startCopy) {
    1187:             // important: temporarily setNew(false) because this affects the behavior of
    1188:             // the getter/setter methods for fkey referrer objects.
    1189:             $copyObj->setNew(false);
    1190:             // store object hash to prevent cycle
    1191:             $this->startCopy = true;
    1192:
    1193:             foreach ($this->getGroupModules() as $relObj) {
    1194:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
    1195:                     $copyObj->addGroupModule($relObj->copy($deepCopy));
    1196:                 }
    1197:             }
    1198:
    1199:             foreach ($this->getModuleI18ns() as $relObj) {
    1200:                 if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
    1201:                     $copyObj->addModuleI18n($relObj->copy($deepCopy));
    1202:                 }
    1203:             }
    1204:
    1205:             //unflag object copy
    1206:             $this->startCopy = false;
    1207:         } // if ($deepCopy)
    1208:
    1209:         if ($makeNew) {
    1210:             $copyObj->setNew(true);
    1211:             $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
    1212:         }
    1213:     }
    1214:
    1215:     /**
    1216:      * Makes a copy of this object that will be inserted as a new row in table when saved.
    1217:      * It creates a new object filling in the simple attributes, but skipping any primary
    1218:      * keys that are defined for the table.
    1219:      *
    1220:      * If desired, this method can also make copies of all associated (fkey referrers)
    1221:      * objects.
    1222:      *
    1223:      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
    1224:      * @return Module Clone of current object.
    1225:      * @throws PropelException
    1226:      */
    1227:     public function copy($deepCopy = false)
    1228:     {
    1229:         // we use get_class(), because this might be a subclass
    1230:         $clazz = get_class($this);
    1231:         $copyObj = new $clazz();
    1232:         $this->copyInto($copyObj, $deepCopy);
    1233:
    1234:         return $copyObj;
    1235:     }
    1236:
    1237:     /**
    1238:      * Returns a peer instance associated with this om.
    1239:      *
    1240:      * Since Peer classes are not to have any instance attributes, this method returns the
    1241:      * same instance for all member of this class. The method could therefore
    1242:      * be static, but this would prevent one from overriding the behavior.
    1243:      *
    1244:      * @return ModulePeer
    1245:      */
    1246:     public function getPeer()
    1247:     {
    1248:         if (self::$peer === null) {
    1249:             self::$peer = new ModulePeer();
    1250:         }
    1251:
    1252:         return self::$peer;
    1253:     }
    1254:
    1255:
    1256:     /**
    1257:      * Initializes a collection based on the name of a relation.
    1258:      * Avoids crafting an 'init[$relationName]s' method name
    1259:      * that wouldn't work when StandardEnglishPluralizer is used.
    1260:      *
    1261:      * @param string $relationName The name of the relation to initialize
    1262:      * @return void
    1263:      */
    1264:     public function initRelation($relationName)
    1265:     {
    1266:         if ('GroupModule' == $relationName) {
    1267:             $this->initGroupModules();
    1268:         }
    1269:         if ('ModuleI18n' == $relationName) {
    1270:             $this->initModuleI18ns();
    1271:         }
    1272:     }
    1273:
    1274:     /**
    1275:      * Clears out the collGroupModules collection
    1276:      *
    1277:      * This does not modify the database; however, it will remove any associated objects, causing
    1278:      * them to be refetched by subsequent calls to accessor method.
    1279:      *
    1280:      * @return Module The current object (for fluent API support)
    1281:      * @see        addGroupModules()
    1282:      */
    1283:     public function clearGroupModules()
    1284:     {
    1285:         $this->collGroupModules = null; // important to set this to null since that means it is uninitialized
    1286:         $this->collGroupModulesPartial = null;
    1287:
    1288:         return $this;
    1289:     }
    1290:
    1291:     /**
    1292:      * reset is the collGroupModules collection loaded partially
    1293:      *
    1294:      * @return void
    1295:      */
    1296:     public function resetPartialGroupModules($v = true)
    1297:     {
    1298:         $this->collGroupModulesPartial = $v;
    1299:     }
    1300:
    1301:     /**
    1302:      * Initializes the collGroupModules collection.
    1303:      *
    1304:      * By default this just sets the collGroupModules collection to an empty array (like clearcollGroupModules());
    1305:      * however, you may wish to override this method in your stub class to provide setting appropriate
    1306:      * to your application -- for example, setting the initial array to the values stored in database.
    1307:      *
    1308:      * @param boolean $overrideExisting If set to true, the method call initializes
    1309:      *                                        the collection even if it is not empty
    1310:      *
    1311:      * @return void
    1312:      */
    1313:     public function initGroupModules($overrideExisting = true)
    1314:     {
    1315:         if (null !== $this->collGroupModules && !$overrideExisting) {
    1316:             return;
    1317:         }
    1318:         $this->collGroupModules = new PropelObjectCollection();
    1319:         $this->collGroupModules->setModel('GroupModule');
    1320:     }
    1321:
    1322:     /**
    1323:      * Gets an array of GroupModule objects which contain a foreign key that references this object.
    1324:      *
    1325:      * If the $criteria is not null, it is used to always fetch the results from the database.
    1326:      * Otherwise the results are fetched from the database the first time, then cached.
    1327:      * Next time the same method is called without $criteria, the cached collection is returned.
    1328:      * If this Module is new, it will return
    1329:      * an empty collection or the current collection; the criteria is ignored on a new object.
    1330:      *
    1331:      * @param Criteria $criteria optional Criteria object to narrow the query
    1332:      * @param PropelPDO $con optional connection object
    1333:      * @return PropelObjectCollection|GroupModule[] List of GroupModule objects
    1334:      * @throws PropelException
    1335:      */
    1336:     public function getGroupModules($criteria = null, PropelPDO $con = null)
    1337:     {
    1338:         $partial = $this->collGroupModulesPartial && !$this->isNew();
    1339:         if (null === $this->collGroupModules || null !== $criteria  || $partial) {
    1340:             if ($this->isNew() && null === $this->collGroupModules) {
    1341:                 // return empty collection
    1342:                 $this->initGroupModules();
    1343:             } else {
    1344:                 $collGroupModules = GroupModuleQuery::create(null, $criteria)
    1345:                     ->filterByModule($this)
    1346:                     ->find($con);
    1347:                 if (null !== $criteria) {
    1348:                     if (false !== $this->collGroupModulesPartial && count($collGroupModules)) {
    1349:                       $this->initGroupModules(false);
    1350:
    1351:                       foreach($collGroupModules as $obj) {
    1352:                         if (false == $this->collGroupModules->contains($obj)) {
    1353:                           $this->collGroupModules->append($obj);
    1354:                         }
    1355:                       }
    1356:
    1357:                       $this->collGroupModulesPartial = true;
    1358:                     }
    1359:
    1360:                     $collGroupModules->getInternalIterator()->rewind();
    1361:                     return $collGroupModules;
    1362:                 }
    1363:
    1364:                 if($partial && $this->collGroupModules) {
    1365:                     foreach($this->collGroupModules as $obj) {
    1366:                         if($obj->isNew()) {
    1367:                             $collGroupModules[] = $obj;
    1368:                         }
    1369:                     }
    1370:                 }
    1371:
    1372:                 $this->collGroupModules = $collGroupModules;
    1373:                 $this->collGroupModulesPartial = false;
    1374:             }
    1375:         }
    1376:
    1377:         return $this->collGroupModules;
    1378:     }
    1379:
    1380:     /**
    1381:      * Sets a collection of GroupModule objects related by a one-to-many relationship
    1382:      * to the current object.
    1383:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
    1384:      * and new objects from the given Propel collection.
    1385:      *
    1386:      * @param PropelCollection $groupModules A Propel collection.
    1387:      * @param PropelPDO $con Optional connection object
    1388:      * @return Module The current object (for fluent API support)
    1389:      */
    1390:     public function setGroupModules(PropelCollection $groupModules, PropelPDO $con = null)
    1391:     {
    1392:         $groupModulesToDelete = $this->getGroupModules(new Criteria(), $con)->diff($groupModules);
    1393:
    1394:         $this->groupModulesScheduledForDeletion = unserialize(serialize($groupModulesToDelete));
    1395:
    1396:         foreach ($groupModulesToDelete as $groupModuleRemoved) {
    1397:             $groupModuleRemoved->setModule(null);
    1398:         }
    1399:
    1400:         $this->collGroupModules = null;
    1401:         foreach ($groupModules as $groupModule) {
    1402:             $this->addGroupModule($groupModule);
    1403:         }
    1404:
    1405:         $this->collGroupModules = $groupModules;
    1406:         $this->collGroupModulesPartial = false;
    1407:
    1408:         return $this;
    1409:     }
    1410:
    1411:     /**
    1412:      * Returns the number of related GroupModule objects.
    1413:      *
    1414:      * @param Criteria $criteria
    1415:      * @param boolean $distinct
    1416:      * @param PropelPDO $con
    1417:      * @return int             Count of related GroupModule objects.
    1418:      * @throws PropelException
    1419:      */
    1420:     public function countGroupModules(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
    1421:     {
    1422:         $partial = $this->collGroupModulesPartial && !$this->isNew();
    1423:         if (null === $this->collGroupModules || null !== $criteria || $partial) {
    1424:             if ($this->isNew() && null === $this->collGroupModules) {
    1425:                 return 0;
    1426:             }
    1427:
    1428:             if($partial && !$criteria) {
    1429:                 return count($this->getGroupModules());
    1430:             }
    1431:             $query = GroupModuleQuery::create(null, $criteria);
    1432:             if ($distinct) {
    1433:                 $query->distinct();
    1434:             }
    1435:
    1436:             return $query
    1437:                 ->filterByModule($this)
    1438:                 ->count($con);
    1439:         }
    1440:
    1441:         return count($this->collGroupModules);
    1442:     }
    1443:
    1444:     /**
    1445:      * Method called to associate a GroupModule object to this object
    1446:      * through the GroupModule foreign key attribute.
    1447:      *
    1448:      * @param    GroupModule $l GroupModule
    1449:      * @return Module The current object (for fluent API support)
    1450:      */
    1451:     public function addGroupModule(GroupModule $l)
    1452:     {
    1453:         if ($this->collGroupModules === null) {
    1454:             $this->initGroupModules();
    1455:             $this->collGroupModulesPartial = true;
    1456:         }
    1457:         if (!in_array($l, $this->collGroupModules->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
    1458:             $this->doAddGroupModule($l);
    1459:         }
    1460:
    1461:         return $this;
    1462:     }
    1463:
    1464:     /**
    1465:      * @param   GroupModule $groupModule The groupModule object to add.
    1466:      */
    1467:     protected function doAddGroupModule($groupModule)
    1468:     {
    1469:         $this->collGroupModules[]= $groupModule;
    1470:         $groupModule->setModule($this);
    1471:     }
    1472:
    1473:     /**
    1474:      * @param   GroupModule $groupModule The groupModule object to remove.
    1475:      * @return Module The current object (for fluent API support)
    1476:      */
    1477:     public function removeGroupModule($groupModule)
    1478:     {
    1479:         if ($this->getGroupModules()->contains($groupModule)) {
    1480:             $this->collGroupModules->remove($this->collGroupModules->search($groupModule));
    1481:             if (null === $this->groupModulesScheduledForDeletion) {
    1482:                 $this->groupModulesScheduledForDeletion = clone $this->collGroupModules;
    1483:                 $this->groupModulesScheduledForDeletion->clear();
    1484:             }
    1485:             $this->groupModulesScheduledForDeletion[]= $groupModule;
    1486:             $groupModule->setModule(null);
    1487:         }
    1488:
    1489:         return $this;
    1490:     }
    1491:
    1492:
    1493:     /**
    1494:      * If this collection has already been initialized with
    1495:      * an identical criteria, it returns the collection.
    1496:      * Otherwise if this Module is new, it will return
    1497:      * an empty collection; or if this Module has previously
    1498:      * been saved, it will retrieve related GroupModules from storage.
    1499:      *
    1500:      * This method is protected by default in order to keep the public
    1501:      * api reasonable.  You can provide public methods for those you
    1502:      * actually need in Module.
    1503:      *
    1504:      * @param Criteria $criteria optional Criteria object to narrow the query
    1505:      * @param PropelPDO $con optional connection object
    1506:      * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
    1507:      * @return PropelObjectCollection|GroupModule[] List of GroupModule objects
    1508:      */
    1509:     public function getGroupModulesJoinGroup($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    1510:     {
    1511:         $query = GroupModuleQuery::create(null, $criteria);
    1512:         $query->joinWith('Group', $join_behavior);
    1513:
    1514:         return $this->getGroupModules($query, $con);
    1515:     }
    1516:
    1517:     /**
    1518:      * Clears out the collModuleI18ns collection
    1519:      *
    1520:      * This does not modify the database; however, it will remove any associated objects, causing
    1521:      * them to be refetched by subsequent calls to accessor method.
    1522:      *
    1523:      * @return Module The current object (for fluent API support)
    1524:      * @see        addModuleI18ns()
    1525:      */
    1526:     public function clearModuleI18ns()
    1527:     {
    1528:         $this->collModuleI18ns = null; // important to set this to null since that means it is uninitialized
    1529:         $this->collModuleI18nsPartial = null;
    1530:
    1531:         return $this;
    1532:     }
    1533:
    1534:     /**
    1535:      * reset is the collModuleI18ns collection loaded partially
    1536:      *
    1537:      * @return void
    1538:      */
    1539:     public function resetPartialModuleI18ns($v = true)
    1540:     {
    1541:         $this->collModuleI18nsPartial = $v;
    1542:     }
    1543:
    1544:     /**
    1545:      * Initializes the collModuleI18ns collection.
    1546:      *
    1547:      * By default this just sets the collModuleI18ns collection to an empty array (like clearcollModuleI18ns());
    1548:      * however, you may wish to override this method in your stub class to provide setting appropriate
    1549:      * to your application -- for example, setting the initial array to the values stored in database.
    1550:      *
    1551:      * @param boolean $overrideExisting If set to true, the method call initializes
    1552:      *                                        the collection even if it is not empty
    1553:      *
    1554:      * @return void
    1555:      */
    1556:     public function initModuleI18ns($overrideExisting = true)
    1557:     {
    1558:         if (null !== $this->collModuleI18ns && !$overrideExisting) {
    1559:             return;
    1560:         }
    1561:         $this->collModuleI18ns = new PropelObjectCollection();
    1562:         $this->collModuleI18ns->setModel('ModuleI18n');
    1563:     }
    1564:
    1565:     /**
    1566:      * Gets an array of ModuleI18n objects which contain a foreign key that references this object.
    1567:      *
    1568:      * If the $criteria is not null, it is used to always fetch the results from the database.
    1569:      * Otherwise the results are fetched from the database the first time, then cached.
    1570:      * Next time the same method is called without $criteria, the cached collection is returned.
    1571:      * If this Module is new, it will return
    1572:      * an empty collection or the current collection; the criteria is ignored on a new object.
    1573:      *
    1574:      * @param Criteria $criteria optional Criteria object to narrow the query
    1575:      * @param PropelPDO $con optional connection object
    1576:      * @return PropelObjectCollection|ModuleI18n[] List of ModuleI18n objects
    1577:      * @throws PropelException
    1578:      */
    1579:     public function getModuleI18ns($criteria = null, PropelPDO $con = null)
    1580:     {
    1581:         $partial = $this->collModuleI18nsPartial && !$this->isNew();
    1582:         if (null === $this->collModuleI18ns || null !== $criteria  || $partial) {
    1583:             if ($this->isNew() && null === $this->collModuleI18ns) {
    1584:                 // return empty collection
    1585:                 $this->initModuleI18ns();
    1586:             } else {
    1587:                 $collModuleI18ns = ModuleI18nQuery::create(null, $criteria)
    1588:                     ->filterByModule($this)
    1589:                     ->find($con);
    1590:                 if (null !== $criteria) {
    1591:                     if (false !== $this->collModuleI18nsPartial && count($collModuleI18ns)) {
    1592:                       $this->initModuleI18ns(false);
    1593:
    1594:                       foreach($collModuleI18ns as $obj) {
    1595:                         if (false == $this->collModuleI18ns->contains($obj)) {
    1596:                           $this->collModuleI18ns->append($obj);
    1597:                         }
    1598:                       }
    1599:
    1600:                       $this->collModuleI18nsPartial = true;
    1601:                     }
    1602:
    1603:                     $collModuleI18ns->getInternalIterator()->rewind();
    1604:                     return $collModuleI18ns;
    1605:                 }
    1606:
    1607:                 if($partial && $this->collModuleI18ns) {
    1608:                     foreach($this->collModuleI18ns as $obj) {
    1609:                         if($obj->isNew()) {
    1610:                             $collModuleI18ns[] = $obj;
    1611:                         }
    1612:                     }
    1613:                 }
    1614:
    1615:                 $this->collModuleI18ns = $collModuleI18ns;
    1616:                 $this->collModuleI18nsPartial = false;
    1617:             }
    1618:         }
    1619:
    1620:         return $this->collModuleI18ns;
    1621:     }
    1622:
    1623:     /**
    1624:      * Sets a collection of ModuleI18n objects related by a one-to-many relationship
    1625:      * to the current object.
    1626:      * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
    1627:      * and new objects from the given Propel collection.
    1628:      *
    1629:      * @param PropelCollection $moduleI18ns A Propel collection.
    1630:      * @param PropelPDO $con Optional connection object
    1631:      * @return Module The current object (for fluent API support)
    1632:      */
    1633:     public function setModuleI18ns(PropelCollection $moduleI18ns, PropelPDO $con = null)
    1634:     {
    1635:         $moduleI18nsToDelete = $this->getModuleI18ns(new Criteria(), $con)->diff($moduleI18ns);
    1636:
    1637:         $this->moduleI18nsScheduledForDeletion = unserialize(serialize($moduleI18nsToDelete));
    1638:
    1639:         foreach ($moduleI18nsToDelete as $moduleI18nRemoved) {
    1640:             $moduleI18nRemoved->setModule(null);
    1641:         }
    1642:
    1643:         $this->collModuleI18ns = null;
    1644:         foreach ($moduleI18ns as $moduleI18n) {
    1645:             $this->addModuleI18n($moduleI18n);
    1646:         }
    1647:
    1648:         $this->collModuleI18ns = $moduleI18ns;
    1649:         $this->collModuleI18nsPartial = false;
    1650:
    1651:         return $this;
    1652:     }
    1653:
    1654:     /**
    1655:      * Returns the number of related ModuleI18n objects.
    1656:      *
    1657:      * @param Criteria $criteria
    1658:      * @param boolean $distinct
    1659:      * @param PropelPDO $con
    1660:      * @return int             Count of related ModuleI18n objects.
    1661:      * @throws PropelException
    1662:      */
    1663:     public function countModuleI18ns(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
    1664:     {
    1665:         $partial = $this->collModuleI18nsPartial && !$this->isNew();
    1666:         if (null === $this->collModuleI18ns || null !== $criteria || $partial) {
    1667:             if ($this->isNew() && null === $this->collModuleI18ns) {
    1668:                 return 0;
    1669:             }
    1670:
    1671:             if($partial && !$criteria) {
    1672:                 return count($this->getModuleI18ns());
    1673:             }
    1674:             $query = ModuleI18nQuery::create(null, $criteria);
    1675:             if ($distinct) {
    1676:                 $query->distinct();
    1677:             }
    1678:
    1679:             return $query
    1680:                 ->filterByModule($this)
    1681:                 ->count($con);
    1682:         }
    1683:
    1684:         return count($this->collModuleI18ns);
    1685:     }
    1686:
    1687:     /**
    1688:      * Method called to associate a ModuleI18n object to this object
    1689:      * through the ModuleI18n foreign key attribute.
    1690:      *
    1691:      * @param    ModuleI18n $l ModuleI18n
    1692:      * @return Module The current object (for fluent API support)
    1693:      */
    1694:     public function addModuleI18n(ModuleI18n $l)
    1695:     {
    1696:         if ($l && $locale = $l->getLocale()) {
    1697:             $this->setLocale($locale);
    1698:             $this->currentTranslations[$locale] = $l;
    1699:         }
    1700:         if ($this->collModuleI18ns === null) {
    1701:             $this->initModuleI18ns();
    1702:             $this->collModuleI18nsPartial = true;
    1703:         }
    1704:         if (!in_array($l, $this->collModuleI18ns->getArrayCopy(), true)) { // only add it if the **same** object is not already associated
    1705:             $this->doAddModuleI18n($l);
    1706:         }
    1707:
    1708:         return $this;
    1709:     }
    1710:
    1711:     /**
    1712:      * @param   ModuleI18n $moduleI18n The moduleI18n object to add.
    1713:      */
    1714:     protected function doAddModuleI18n($moduleI18n)
    1715:     {
    1716:         $this->collModuleI18ns[]= $moduleI18n;
    1717:         $moduleI18n->setModule($this);
    1718:     }
    1719:
    1720:     /**
    1721:      * @param   ModuleI18n $moduleI18n The moduleI18n object to remove.
    1722:      * @return Module The current object (for fluent API support)
    1723:      */
    1724:     public function removeModuleI18n($moduleI18n)
    1725:     {
    1726:         if ($this->getModuleI18ns()->contains($moduleI18n)) {
    1727:             $this->collModuleI18ns->remove($this->collModuleI18ns->search($moduleI18n));
    1728:             if (null === $this->moduleI18nsScheduledForDeletion) {
    1729:                 $this->moduleI18nsScheduledForDeletion = clone $this->collModuleI18ns;
    1730:                 $this->moduleI18nsScheduledForDeletion->clear();
    1731:             }
    1732:             $this->moduleI18nsScheduledForDeletion[]= clone $moduleI18n;
    1733:             $moduleI18n->setModule(null);
    1734:         }
    1735:
    1736:         return $this;
    1737:     }
    1738:
    1739:     /**
    1740:      * Clears the current object and sets all attributes to their default values
    1741:      */
    1742:     public function clear()
    1743:     {
    1744:         $this->id = null;
    1745:         $this->code = null;
    1746:         $this->type = null;
    1747:         $this->activate = null;
    1748:         $this->position = null;
    1749:         $this->created_at = null;
    1750:         $this->updated_at = null;
    1751:         $this->alreadyInSave = false;
    1752:         $this->alreadyInValidation = false;
    1753:         $this->alreadyInClearAllReferencesDeep = false;
    1754:         $this->clearAllReferences();
    1755:         $this->resetModified();
    1756:         $this->setNew(true);
    1757:         $this->setDeleted(false);
    1758:     }
    1759:
    1760:     /**
    1761:      * Resets all references to other model objects or collections of model objects.
    1762:      *
    1763:      * This method is a user-space workaround for PHP's inability to garbage collect
    1764:      * objects with circular references (even in PHP 5.3). This is currently necessary
    1765:      * when using Propel in certain daemon or large-volumne/high-memory operations.
    1766:      *
    1767:      * @param boolean $deep Whether to also clear the references on all referrer objects.
    1768:      */
    1769:     public function clearAllReferences($deep = false)
    1770:     {
    1771:         if ($deep && !$this->alreadyInClearAllReferencesDeep) {
    1772:             $this->alreadyInClearAllReferencesDeep = true;
    1773:             if ($this->collGroupModules) {
    1774:                 foreach ($this->collGroupModules as $o) {
    1775:                     $o->clearAllReferences($deep);
    1776:                 }
    1777:             }
    1778:             if ($this->collModuleI18ns) {
    1779:                 foreach ($this->collModuleI18ns as $o) {
    1780:                     $o->clearAllReferences($deep);
    1781:                 }
    1782:             }
    1783:
    1784:             $this->alreadyInClearAllReferencesDeep = false;
    1785:         } // if ($deep)
    1786:
    1787:         // i18n behavior
    1788:         $this->currentLocale = 'en_US';
    1789:         $this->currentTranslations = null;
    1790:
    1791:         if ($this->collGroupModules instanceof PropelCollection) {
    1792:             $this->collGroupModules->clearIterator();
    1793:         }
    1794:         $this->collGroupModules = null;
    1795:         if ($this->collModuleI18ns instanceof PropelCollection) {
    1796:             $this->collModuleI18ns->clearIterator();
    1797:         }
    1798:         $this->collModuleI18ns = null;
    1799:     }
    1800:
    1801:     /**
    1802:      * return the string representation of this object
    1803:      *
    1804:      * @return string
    1805:      */
    1806:     public function __toString()
    1807:     {
    1808:         return (string) $this->exportTo(ModulePeer::DEFAULT_STRING_FORMAT);
    1809:     }
    1810:
    1811:     /**
    1812:      * return true is the object is in saving state
    1813:      *
    1814:      * @return boolean
    1815:      */
    1816:     public function isAlreadyInSave()
    1817:     {
    1818:         return $this->alreadyInSave;
    1819:     }
    1820:
    1821:     // timestampable behavior
    1822:
    1823:     /**
    1824:      * Mark the current object so that the update date doesn't get updated during next save
    1825:      *
    1826:      * @return     Module The current object (for fluent API support)
    1827:      */
    1828:     public function keepUpdateDateUnchanged()
    1829:     {
    1830:         $this->modifiedColumns[] = ModulePeer::UPDATED_AT;
    1831:
    1832:         return $this;
    1833:     }
    1834:
    1835:     // i18n behavior
    1836:
    1837:     /**
    1838:      * Sets the locale for translations
    1839:      *
    1840:      * @param     string $locale Locale to use for the translation, e.g. 'fr_FR'
    1841:      *
    1842:      * @return    Module The current object (for fluent API support)
    1843:      */
    1844:     public function setLocale($locale = 'en_US')
    1845:     {
    1846:         $this->currentLocale = $locale;
    1847:
    1848:         return $this;
    1849:     }
    1850:
    1851:     /**
    1852:      * Gets the locale for translations
    1853:      *
    1854:      * @return    string $locale Locale to use for the translation, e.g. 'fr_FR'
    1855:      */
    1856:     public function getLocale()
    1857:     {
    1858:         return $this->currentLocale;
    1859:     }
    1860:
    1861:     /**
    1862:      * Returns the current translation for a given locale
    1863:      *
    1864:      * @param     string $locale Locale to use for the translation, e.g. 'fr_FR'
    1865:      * @param     PropelPDO $con an optional connection object
    1866:      *
    1867:      * @return ModuleI18n */
    1868:     public function getTranslation($locale = 'en_US', PropelPDO $con = null)
    1869:     {
    1870:         if (!isset($this->currentTranslations[$locale])) {
    1871:             if (null !== $this->collModuleI18ns) {
    1872:                 foreach ($this->collModuleI18ns as $translation) {
    1873:                     if ($translation->getLocale() == $locale) {
    1874:                         $this->currentTranslations[$locale] = $translation;
    1875:
    1876:                         return $translation;
    1877:                     }
    1878:                 }
    1879:             }
    1880:             if ($this->isNew()) {
    1881:                 $translation = new ModuleI18n();
    1882:                 $translation->setLocale($locale);
    1883:             } else {
    1884:                 $translation = ModuleI18nQuery::create()
    1885:                     ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
    1886:                     ->findOneOrCreate($con);
    1887:                 $this->currentTranslations[$locale] = $translation;
    1888:             }
    1889:             $this->addModuleI18n($translation);
    1890:         }
    1891:
    1892:         return $this->currentTranslations[$locale];
    1893:     }
    1894:
    1895:     /**
    1896:      * Remove the translation for a given locale
    1897:      *
    1898:      * @param     string $locale Locale to use for the translation, e.g. 'fr_FR'
    1899:      * @param     PropelPDO $con an optional connection object
    1900:      *
    1901:      * @return    Module The current object (for fluent API support)
    1902:      */
    1903:     public function removeTranslation($locale = 'en_US', PropelPDO $con = null)
    1904:     {
    1905:         if (!$this->isNew()) {
    1906:             ModuleI18nQuery::create()
    1907:                 ->filterByPrimaryKey(array($this->getPrimaryKey(), $locale))
    1908:                 ->delete($con);
    1909:         }
    1910:         if (isset($this->currentTranslations[$locale])) {
    1911:             unset($this->currentTranslations[$locale]);
    1912:         }
    1913:         foreach ($this->collModuleI18ns as $key => $translation) {
    1914:             if ($translation->getLocale() == $locale) {
    1915:                 unset($this->collModuleI18ns[$key]);
    1916:                 break;
    1917:             }
    1918:         }
    1919:
    1920:         return $this;
    1921:     }
    1922:
    1923:     /**
    1924:      * Returns the current translation
    1925:      *
    1926:      * @param     PropelPDO $con an optional connection object
    1927:      *
    1928:      * @return ModuleI18n */
    1929:     public function getCurrentTranslation(PropelPDO $con = null)
    1930:     {
    1931:         return $this->getTranslation($this->getLocale(), $con);
    1932:     }
    1933:
    1934:
    1935:         /**
    1936:          * Get the [title] column value.
    1937:          *
    1938:          * @return string
    1939:          */
    1940:         public function getTitle()
    1941:         {
    1942:         return $this->getCurrentTranslation()->getTitle();
    1943:     }
    1944:
    1945:
    1946:         /**
    1947:          * Set the value of [title] column.
    1948:          *
    1949:          * @param string $v new value
    1950:          * @return ModuleI18n The current object (for fluent API support)
    1951:          */
    1952:         public function setTitle($v)
    1953:         {    $this->getCurrentTranslation()->setTitle($v);
    1954:
    1955:         return $this;
    1956:     }
    1957:
    1958:
    1959:         /**
    1960:          * Get the [description] column value.
    1961:          *
    1962:          * @return string
    1963:          */
    1964:         public function getDescription()
    1965:         {
    1966:         return $this->getCurrentTranslation()->getDescription();
    1967:     }
    1968:
    1969:
    1970:         /**
    1971:          * Set the value of [description] column.
    1972:          *
    1973:          * @param string $v new value
    1974:          * @return ModuleI18n The current object (for fluent API support)
    1975:          */
    1976:         public function setDescription($v)
    1977:         {    $this->getCurrentTranslation()->setDescription($v);
    1978:
    1979:         return $this;
    1980:     }
    1981:
    1982:
    1983:         /**
    1984:          * Get the [chapo] column value.
    1985:          *
    1986:          * @return string
    1987:          */
    1988:         public function getChapo()
    1989:         {
    1990:         return $this->getCurrentTranslation()->getChapo();
    1991:     }
    1992:
    1993:
    1994:         /**
    1995:          * Set the value of [chapo] column.
    1996:          *
    1997:          * @param string $v new value
    1998:          * @return ModuleI18n The current object (for fluent API support)
    1999:          */
    2000:         public function setChapo($v)
    2001:         {    $this->getCurrentTranslation()->setChapo($v);
    2002:
    2003:         return $this;
    2004:     }
    2005:
    2006:
    2007:         /**
    2008:          * Get the [postscriptum] column value.
    2009:          *
    2010:          * @return string
    2011:          */
    2012:         public function getPostscriptum()
    2013:         {
    2014:         return $this->getCurrentTranslation()->getPostscriptum();
    2015:     }
    2016:
    2017:
    2018:         /**
    2019:          * Set the value of [postscriptum] column.
    2020:          *
    2021:          * @param string $v new value
    2022:          * @return ModuleI18n The current object (for fluent API support)
    2023:          */
    2024:         public function setPostscriptum($v)
    2025:         {    $this->getCurrentTranslation()->setPostscriptum($v);
    2026:
    2027:         return $this;
    2028:     }
    2029:
    2030: }
    2031: