Author: david
Date: Wed Nov 18 16:53:42 2009
New Revision: 3918

Log:
Add q_other_name model files missed in r3917.

Added:
   trunk/lib/model/map/OtherNameI18nMapBuilder.php   (contents, props changed)
   trunk/lib/model/map/OtherNameMapBuilder.php   (contents, props changed)
   trunk/lib/model/om/BaseOtherName.php   (contents, props changed)
   trunk/lib/model/om/BaseOtherNameI18n.php   (contents, props changed)

Added: trunk/lib/model/map/OtherNameI18nMapBuilder.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/lib/model/map/OtherNameI18nMapBuilder.php     Wed Nov 18 16:53:42 
2009        (r3918)
@@ -0,0 +1,47 @@
+<?php
+
+
+
+class OtherNameI18nMapBuilder implements MapBuilder {
+
+       
+       const CLASS_NAME = 'lib.model.map.OtherNameI18nMapBuilder';
+
+       
+       private $dbMap;
+
+       
+       public function isBuilt()
+       {
+               return ($this->dbMap !== null);
+       }
+
+       
+       public function getDatabaseMap()
+       {
+               return $this->dbMap;
+       }
+
+       
+       public function doBuild()
+       {
+               $this->dbMap = 
Propel::getDatabaseMap(QubitOtherNameI18n::DATABASE_NAME);
+
+               $tMap = $this->dbMap->addTable(QubitOtherNameI18n::TABLE_NAME);
+               $tMap->setPhpName('otherNameI18n');
+               $tMap->setClassname('QubitOtherNameI18n');
+
+               $tMap->setUseIdGenerator(false);
+
+               $tMap->addColumn('NAME', 'name', 'VARCHAR', false, 255);
+
+               $tMap->addColumn('NOTE', 'note', 'VARCHAR', false, 255);
+
+               $tMap->addForeignPrimaryKey('ID', 'id', 'INTEGER' , 
'q_other_name', 'ID', true, null);
+
+               $tMap->addPrimaryKey('CULTURE', 'culture', 'VARCHAR', true, 7);
+
+               $tMap->addColumn('SERIAL_NUMBER', 'serialNumber', 'INTEGER', 
true, null);
+
+       } 
+} 
\ No newline at end of file

Added: trunk/lib/model/map/OtherNameMapBuilder.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/lib/model/map/OtherNameMapBuilder.php Wed Nov 18 16:53:42 2009        
(r3918)
@@ -0,0 +1,51 @@
+<?php
+
+
+
+class OtherNameMapBuilder implements MapBuilder {
+
+       
+       const CLASS_NAME = 'lib.model.map.OtherNameMapBuilder';
+
+       
+       private $dbMap;
+
+       
+       public function isBuilt()
+       {
+               return ($this->dbMap !== null);
+       }
+
+       
+       public function getDatabaseMap()
+       {
+               return $this->dbMap;
+       }
+
+       
+       public function doBuild()
+       {
+               $this->dbMap = 
Propel::getDatabaseMap(QubitOtherName::DATABASE_NAME);
+
+               $tMap = $this->dbMap->addTable(QubitOtherName::TABLE_NAME);
+               $tMap->setPhpName('otherName');
+               $tMap->setClassname('QubitOtherName');
+
+               $tMap->setUseIdGenerator(true);
+
+               $tMap->addForeignKey('OBJECT_ID', 'objectId', 'INTEGER', 
'q_object', 'ID', true, null);
+
+               $tMap->addForeignKey('TYPE_ID', 'typeId', 'INTEGER', 'q_term', 
'ID', false, null);
+
+               $tMap->addColumn('CREATED_AT', 'createdAt', 'TIMESTAMP', true, 
null);
+
+               $tMap->addColumn('UPDATED_AT', 'updatedAt', 'TIMESTAMP', true, 
null);
+
+               $tMap->addColumn('SOURCE_CULTURE', 'sourceCulture', 'VARCHAR', 
true, 7);
+
+               $tMap->addPrimaryKey('ID', 'id', 'INTEGER', true, null);
+
+               $tMap->addColumn('SERIAL_NUMBER', 'serialNumber', 'INTEGER', 
true, null);
+
+       } 
+} 
\ No newline at end of file

Added: trunk/lib/model/om/BaseOtherName.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/lib/model/om/BaseOtherName.php        Wed Nov 18 16:53:42 2009        
(r3918)
@@ -0,0 +1,620 @@
+<?php
+
+abstract class BaseOtherName implements ArrayAccess
+{
+  const
+    DATABASE_NAME = 'propel',
+
+    TABLE_NAME = 'q_other_name',
+
+    OBJECT_ID = 'q_other_name.OBJECT_ID',
+    TYPE_ID = 'q_other_name.TYPE_ID',
+    CREATED_AT = 'q_other_name.CREATED_AT',
+    UPDATED_AT = 'q_other_name.UPDATED_AT',
+    SOURCE_CULTURE = 'q_other_name.SOURCE_CULTURE',
+    ID = 'q_other_name.ID',
+    SERIAL_NUMBER = 'q_other_name.SERIAL_NUMBER';
+
+  public static function addSelectColumns(Criteria $criteria)
+  {
+    $criteria->addSelectColumn(QubitOtherName::OBJECT_ID);
+    $criteria->addSelectColumn(QubitOtherName::TYPE_ID);
+    $criteria->addSelectColumn(QubitOtherName::CREATED_AT);
+    $criteria->addSelectColumn(QubitOtherName::UPDATED_AT);
+    $criteria->addSelectColumn(QubitOtherName::SOURCE_CULTURE);
+    $criteria->addSelectColumn(QubitOtherName::ID);
+    $criteria->addSelectColumn(QubitOtherName::SERIAL_NUMBER);
+
+    return $criteria;
+  }
+
+  protected static
+    $otherNames = array();
+
+  protected
+    $keys = array(),
+    $row = array();
+
+  public static function getFromRow(array $row)
+  {
+    $keys = array();
+    $keys['id'] = $row[5];
+
+    $key = serialize($keys);
+    if (!isset(self::$otherNames[$key]))
+    {
+      $otherName = new QubitOtherName;
+
+      $otherName->keys = $keys;
+      $otherName->row = $row;
+
+      $otherName->new = false;
+
+      self::$otherNames[$key] = $otherName;
+    }
+
+    return self::$otherNames[$key];
+  }
+
+  public static function get(Criteria $criteria, array $options = array())
+  {
+    if (!isset($options['connection']))
+    {
+      $options['connection'] = 
Propel::getConnection(QubitOtherName::DATABASE_NAME);
+    }
+
+    self::addSelectColumns($criteria);
+
+    return QubitQuery::createFromCriteria($criteria, 'QubitOtherName', 
$options);
+  }
+
+  public static function getAll(array $options = array())
+  {
+    return self::get(new Criteria, $options);
+  }
+
+  public static function getOne(Criteria $criteria, array $options = array())
+  {
+    $criteria->setLimit(1);
+
+    return self::get($criteria, $options)->__get(0, array('defaultValue' => 
null));
+  }
+
+  public static function getById($id, array $options = array())
+  {
+    $criteria = new Criteria;
+    $criteria->add(QubitOtherName::ID, $id);
+
+    if (1 == count($query = self::get($criteria, $options)))
+    {
+      return $query[0];
+    }
+  }
+
+  public static function doDelete(Criteria $criteria, $connection = null)
+  {
+    if (!isset($connection))
+    {
+      $connection = 
QubitTransactionFilter::getConnection(QubitOtherName::DATABASE_NAME);
+    }
+
+    $affectedRows = 0;
+
+    $affectedRows += BasePeer::doDelete($criteria, $connection);
+
+    return $affectedRows;
+  }
+
+  protected
+    $tables = array();
+
+  public function __construct()
+  {
+    $this->tables[] = 
Propel::getDatabaseMap(QubitOtherName::DATABASE_NAME)->getTable(QubitOtherName::TABLE_NAME);
+  }
+
+  protected
+    $values = array(),
+    $refFkValues = array();
+
+  protected function rowOffsetGet($name, $offset, $options)
+  {
+    if (empty($options['clean']) && array_key_exists($name, $this->values))
+    {
+      return $this->values[$name];
+    }
+
+    if (array_key_exists($name, $this->keys))
+    {
+      return $this->keys[$name];
+    }
+
+    if (!array_key_exists($offset, $this->row))
+    {
+      if ($this->new)
+      {
+        return;
+      }
+
+      if (!isset($options['connection']))
+      {
+        $options['connection'] = 
Propel::getConnection(QubitOtherName::DATABASE_NAME);
+      }
+
+      $criteria = new Criteria;
+      $criteria->add(QubitOtherName::ID, $this->id);
+
+      call_user_func(array(get_class($this), 'addSelectColumns'), $criteria);
+
+      $statement = BasePeer::doSelect($criteria, $options['connection']);
+      $this->row = $statement->fetch();
+    }
+
+    return $this->row[$offset];
+  }
+
+  public function __isset($name)
+  {
+    $args = func_get_args();
+
+    $options = array();
+    if (1 < count($args))
+    {
+      $options = $args[1];
+    }
+
+    $offset = 0;
+    foreach ($this->tables as $table)
+    {
+      foreach ($table->getColumns() as $column)
+      {
+        if ($name == $column->getPhpName())
+        {
+          return null !== $this->rowOffsetGet($name, $offset, $options);
+        }
+
+        if ($name.'Id' == $column->getPhpName())
+        {
+          return null !== $this->rowOffsetGet($name.'Id', $offset, $options);
+        }
+
+        $offset++;
+      }
+    }
+
+    if ('otherNameI18ns' == $name)
+    {
+      return true;
+    }
+
+    try
+    {
+      if (!$value = 
call_user_func_array(array($this->getCurrentotherNameI18n($options), 
'__isset'), $args) && !empty($options['cultureFallback']))
+      {
+        return 
call_user_func_array(array($this->getCurrentotherNameI18n(array('sourceCulture' 
=> true) + $options), '__isset'), $args);
+      }
+
+      return $value;
+    }
+    catch (sfException $e)
+    {
+    }
+
+    throw new sfException('Unknown record property "'.$name.'" on 
"'.get_class($this).'"');
+  }
+
+  public function offsetExists($offset)
+  {
+    $args = func_get_args();
+
+    return call_user_func_array(array($this, '__isset'), $args);
+  }
+
+  public function __get($name)
+  {
+    $args = func_get_args();
+
+    $options = array();
+    if (1 < count($args))
+    {
+      $options = $args[1];
+    }
+
+    $offset = 0;
+    foreach ($this->tables as $table)
+    {
+      foreach ($table->getColumns() as $column)
+      {
+        if ($name == $column->getPhpName())
+        {
+          return $this->rowOffsetGet($name, $offset, $options);
+        }
+
+        if ($name.'Id' == $column->getPhpName())
+        {
+          $relatedTable = 
$column->getTable()->getDatabaseMap()->getTable($column->getRelatedTableName());
+
+          return call_user_func(array($relatedTable->getClassName(), 
'getBy'.ucfirst($relatedTable->getColumn($column->getRelatedColumnName())->getPhpName())),
 $this->rowOffsetGet($name.'Id', $offset, $options));
+        }
+
+        $offset++;
+      }
+    }
+
+    if ('otherNameI18ns' == $name)
+    {
+      if (!isset($this->refFkValues['otherNameI18ns']))
+      {
+        if (!isset($this->id))
+        {
+          $this->refFkValues['otherNameI18ns'] = QubitQuery::create();
+        }
+        else
+        {
+          $this->refFkValues['otherNameI18ns'] = 
self::getotherNameI18nsById($this->id, array('self' => $this) + $options);
+        }
+      }
+
+      return $this->refFkValues['otherNameI18ns'];
+    }
+
+    try
+    {
+      if (1 > strlen($value = 
call_user_func_array(array($this->getCurrentotherNameI18n($options), '__get'), 
$args)) && !empty($options['cultureFallback']))
+      {
+        return 
call_user_func_array(array($this->getCurrentotherNameI18n(array('sourceCulture' 
=> true) + $options), '__get'), $args);
+      }
+
+      return $value;
+    }
+    catch (sfException $e)
+    {
+    }
+
+    throw new sfException('Unknown record property "'.$name.'" on 
"'.get_class($this).'"');
+  }
+
+  public function offsetGet($offset)
+  {
+    $args = func_get_args();
+
+    return call_user_func_array(array($this, '__get'), $args);
+  }
+
+  public function __set($name, $value)
+  {
+    $args = func_get_args();
+
+    $options = array();
+    if (2 < count($args))
+    {
+      $options = $args[2];
+    }
+
+    $offset = 0;
+    foreach ($this->tables as $table)
+    {
+      foreach ($table->getColumns() as $column)
+      {
+        if ($name == $column->getPhpName())
+        {
+          $this->values[$name] = $value;
+        }
+
+        if ($name.'Id' == $column->getPhpName())
+        {
+          $relatedTable = 
$column->getTable()->getDatabaseMap()->getTable($column->getRelatedTableName());
+
+          $this->values[$name.'Id'] = 
$value->__get($relatedTable->getColumn($column->getRelatedColumnName())->getPhpName(),
 $options);
+        }
+
+        $offset++;
+      }
+    }
+
+    call_user_func_array(array($this->getCurrentotherNameI18n($options), 
'__set'), $args);
+
+    return $this;
+  }
+
+  public function offsetSet($offset, $value)
+  {
+    $args = func_get_args();
+
+    return call_user_func_array(array($this, '__set'), $args);
+  }
+
+  public function __unset($name)
+  {
+    $args = func_get_args();
+
+    $options = array();
+    if (1 < count($args))
+    {
+      $options = $args[1];
+    }
+
+    $offset = 0;
+    foreach ($this->tables as $table)
+    {
+      foreach ($table->getColumns() as $column)
+      {
+        if ($name == $column->getPhpName())
+        {
+          $this->values[$name] = null;
+        }
+
+        if ($name.'Id' == $column->getPhpName())
+        {
+          $this->values[$name.'Id'] = null;
+        }
+
+        $offset++;
+      }
+    }
+
+    call_user_func_array(array($this->getCurrentotherNameI18n($options), 
'__unset'), $args);
+
+    return $this;
+  }
+
+  public function offsetUnset($offset)
+  {
+    $args = func_get_args();
+
+    return call_user_func_array(array($this, '__unset'), $args);
+  }
+
+  public function clear()
+  {
+    foreach ($this->otherNameI18ns as $otherNameI18n)
+    {
+      $otherNameI18n->clear();
+    }
+
+    $this->row = $this->values = array();
+
+    return $this;
+  }
+
+  protected
+    $new = true;
+
+  protected
+    $deleted = false;
+
+  public function save($connection = null)
+  {
+    if ($this->deleted)
+    {
+      throw new PropelException('You cannot save an object that has been 
deleted.');
+    }
+
+    if ($this->new)
+    {
+      $this->insert($connection);
+    }
+    else
+    {
+      $this->update($connection);
+    }
+
+    $offset = 0;
+    foreach ($this->tables as $table)
+    {
+      foreach ($table->getColumns() as $column)
+      {
+        if (array_key_exists($column->getPhpName(), $this->values))
+        {
+          $this->row[$offset] = $this->values[$column->getPhpName()];
+        }
+
+        $offset++;
+      }
+    }
+
+    $this->new = false;
+    $this->values = array();
+
+    foreach ($this->otherNameI18ns as $otherNameI18n)
+    {
+      $otherNameI18n->id = $this->id;
+
+      $otherNameI18n->save($connection);
+    }
+
+    return $this;
+  }
+
+  protected function insert($connection = null)
+  {
+    if (!isset($connection))
+    {
+      $connection = 
QubitTransactionFilter::getConnection(QubitOtherName::DATABASE_NAME);
+    }
+
+    $offset = 0;
+    foreach ($this->tables as $table)
+    {
+      $criteria = new Criteria;
+      foreach ($table->getColumns() as $column)
+      {
+        if (!array_key_exists($column->getPhpName(), $this->values))
+        {
+          if ('createdAt' == $column->getPhpName() || 'updatedAt' == 
$column->getPhpName())
+          {
+            $this->values[$column->getPhpName()] = new DateTime;
+          }
+
+          if ('sourceCulture' == $column->getPhpName())
+          {
+            $this->values['sourceCulture'] = sfPropel::getDefaultCulture();
+          }
+        }
+
+        if (array_key_exists($column->getPhpName(), $this->values))
+        {
+          $criteria->add($column->getFullyQualifiedName(), 
$this->values[$column->getPhpName()]);
+        }
+
+        $offset++;
+      }
+
+      if (null !== $id = BasePeer::doInsert($criteria, $connection))
+      {
+                        if ($this->tables[0] == $table)
+        {
+          $columns = $table->getPrimaryKeyColumns();
+          $this->values[$columns[0]->getPhpName()] = $id;
+        }
+      }
+    }
+
+    return $this;
+  }
+
+  protected function update($connection = null)
+  {
+    if (!isset($connection))
+    {
+      $connection = 
QubitTransactionFilter::getConnection(QubitOtherName::DATABASE_NAME);
+    }
+
+    $offset = 0;
+    foreach ($this->tables as $table)
+    {
+      $criteria = new Criteria;
+      $selectCriteria = new Criteria;
+      foreach ($table->getColumns() as $column)
+      {
+        if (!array_key_exists($column->getPhpName(), $this->values))
+        {
+          if ('updatedAt' == $column->getPhpName())
+          {
+            $this->values['updatedAt'] = new DateTime;
+          }
+        }
+
+        if (array_key_exists($column->getPhpName(), $this->values))
+        {
+          if ('serialNumber' == $column->getPhpName())
+          {
+            $selectCriteria->add($column->getFullyQualifiedName(), 
$this->values[$column->getPhpName()]++);
+          }
+
+          $criteria->add($column->getFullyQualifiedName(), 
$this->values[$column->getPhpName()]);
+        }
+
+        if ($column->isPrimaryKey())
+        {
+          $selectCriteria->add($column->getFullyQualifiedName(), 
$this->row[$offset]);
+        }
+
+        $offset++;
+      }
+
+      if ($criteria->size() > 0)
+      {
+        BasePeer::doUpdate($selectCriteria, $criteria, $connection);
+      }
+    }
+
+    return $this;
+  }
+
+  public function delete($connection = null)
+  {
+    if ($this->deleted)
+    {
+      throw new PropelException('This object has already been deleted.');
+    }
+
+    $criteria = new Criteria;
+    $criteria->add(QubitOtherName::ID, $this->id);
+
+    self::doDelete($criteria, $connection);
+
+    $this->deleted = true;
+
+    return $this;
+  }
+
+       
+       public function getPrimaryKey()
+       {
+               return $this->getid();
+       }
+
+       
+       public function setPrimaryKey($key)
+       {
+               $this->setid($key);
+       }
+
+  public static function addJoinobjectCriteria(Criteria $criteria)
+  {
+    $criteria->addJoin(QubitOtherName::OBJECT_ID, QubitObject::ID);
+
+    return $criteria;
+  }
+
+  public static function addJointypeCriteria(Criteria $criteria)
+  {
+    $criteria->addJoin(QubitOtherName::TYPE_ID, QubitTerm::ID);
+
+    return $criteria;
+  }
+
+  public static function addotherNameI18nsCriteriaById(Criteria $criteria, $id)
+  {
+    $criteria->add(QubitOtherNameI18n::ID, $id);
+
+    return $criteria;
+  }
+
+  public static function getotherNameI18nsById($id, array $options = array())
+  {
+    $criteria = new Criteria;
+    self::addotherNameI18nsCriteriaById($criteria, $id);
+
+    return QubitOtherNameI18n::get($criteria, $options);
+  }
+
+  public function addotherNameI18nsCriteria(Criteria $criteria)
+  {
+    return self::addotherNameI18nsCriteriaById($criteria, $this->id);
+  }
+
+  public function getCurrentotherNameI18n(array $options = array())
+  {
+    if (!empty($options['sourceCulture']))
+    {
+      $options['culture'] = $this->sourceCulture;
+    }
+
+    if (!isset($options['culture']))
+    {
+      $options['culture'] = sfPropel::getDefaultCulture();
+    }
+
+    $otherNameI18ns = $this->otherNameI18ns->indexBy('culture');
+    if (!isset($otherNameI18ns[$options['culture']]))
+    {
+      $otherNameI18ns[$options['culture']] = new QubitOtherNameI18n;
+    }
+
+    return $otherNameI18ns[$options['culture']];
+  }
+
+  public function __call($name, $args)
+  {
+    if ('get' == substr($name, 0, 3) || 'set' == substr($name, 0, 3))
+    {
+      $args = array_merge(array(strtolower(substr($name, 3, 1)).substr($name, 
4)), $args);
+
+      return call_user_func_array(array($this, '__'.substr($name, 0, 3)), 
$args);
+    }
+
+    throw new sfException('Call to undefined method 
'.get_class($this).'::'.$name);
+  }
+}

Added: trunk/lib/model/om/BaseOtherNameI18n.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/lib/model/om/BaseOtherNameI18n.php    Wed Nov 18 16:53:42 2009        
(r3918)
@@ -0,0 +1,510 @@
+<?php
+
+abstract class BaseOtherNameI18n implements ArrayAccess
+{
+  const
+    DATABASE_NAME = 'propel',
+
+    TABLE_NAME = 'q_other_name_i18n',
+
+    NAME = 'q_other_name_i18n.NAME',
+    NOTE = 'q_other_name_i18n.NOTE',
+    ID = 'q_other_name_i18n.ID',
+    CULTURE = 'q_other_name_i18n.CULTURE',
+    SERIAL_NUMBER = 'q_other_name_i18n.SERIAL_NUMBER';
+
+  public static function addSelectColumns(Criteria $criteria)
+  {
+    $criteria->addSelectColumn(QubitOtherNameI18n::NAME);
+    $criteria->addSelectColumn(QubitOtherNameI18n::NOTE);
+    $criteria->addSelectColumn(QubitOtherNameI18n::ID);
+    $criteria->addSelectColumn(QubitOtherNameI18n::CULTURE);
+    $criteria->addSelectColumn(QubitOtherNameI18n::SERIAL_NUMBER);
+
+    return $criteria;
+  }
+
+  protected static
+    $otherNameI18ns = array();
+
+  protected
+    $keys = array(),
+    $row = array();
+
+  public static function getFromRow(array $row)
+  {
+    $keys = array();
+    $keys['id'] = $row[2];
+    $keys['culture'] = $row[3];
+
+    $key = serialize($keys);
+    if (!isset(self::$otherNameI18ns[$key]))
+    {
+      $otherNameI18n = new QubitOtherNameI18n;
+
+      $otherNameI18n->keys = $keys;
+      $otherNameI18n->row = $row;
+
+      $otherNameI18n->new = false;
+
+      self::$otherNameI18ns[$key] = $otherNameI18n;
+    }
+
+    return self::$otherNameI18ns[$key];
+  }
+
+  public static function get(Criteria $criteria, array $options = array())
+  {
+    if (!isset($options['connection']))
+    {
+      $options['connection'] = 
Propel::getConnection(QubitOtherNameI18n::DATABASE_NAME);
+    }
+
+    self::addSelectColumns($criteria);
+
+    return QubitQuery::createFromCriteria($criteria, 'QubitOtherNameI18n', 
$options);
+  }
+
+  public static function getAll(array $options = array())
+  {
+    return self::get(new Criteria, $options);
+  }
+
+  public static function getOne(Criteria $criteria, array $options = array())
+  {
+    $criteria->setLimit(1);
+
+    return self::get($criteria, $options)->__get(0, array('defaultValue' => 
null));
+  }
+
+  public static function getByIdAndCulture($id, $culture, array $options = 
array())
+  {
+    $criteria = new Criteria;
+    $criteria->add(QubitOtherNameI18n::ID, $id);
+    $criteria->add(QubitOtherNameI18n::CULTURE, $culture);
+
+    if (1 == count($query = self::get($criteria, $options)))
+    {
+      return $query[0];
+    }
+  }
+
+  public static function doDelete(Criteria $criteria, $connection = null)
+  {
+    if (!isset($connection))
+    {
+      $connection = 
QubitTransactionFilter::getConnection(QubitOtherNameI18n::DATABASE_NAME);
+    }
+
+    $affectedRows = 0;
+
+    $affectedRows += BasePeer::doDelete($criteria, $connection);
+
+    return $affectedRows;
+  }
+
+  protected
+    $tables = array();
+
+  public function __construct()
+  {
+    $this->tables[] = 
Propel::getDatabaseMap(QubitOtherNameI18n::DATABASE_NAME)->getTable(QubitOtherNameI18n::TABLE_NAME);
+  }
+
+  protected
+    $values = array(),
+    $refFkValues = array();
+
+  protected function rowOffsetGet($name, $offset, $options)
+  {
+    if (empty($options['clean']) && array_key_exists($name, $this->values))
+    {
+      return $this->values[$name];
+    }
+
+    if (array_key_exists($name, $this->keys))
+    {
+      return $this->keys[$name];
+    }
+
+    if (!array_key_exists($offset, $this->row))
+    {
+      if ($this->new)
+      {
+        return;
+      }
+
+      if (!isset($options['connection']))
+      {
+        $options['connection'] = 
Propel::getConnection(QubitOtherNameI18n::DATABASE_NAME);
+      }
+
+      $criteria = new Criteria;
+      $criteria->add(QubitOtherNameI18n::ID, $this->id);
+      $criteria->add(QubitOtherNameI18n::CULTURE, $this->culture);
+
+      call_user_func(array(get_class($this), 'addSelectColumns'), $criteria);
+
+      $statement = BasePeer::doSelect($criteria, $options['connection']);
+      $this->row = $statement->fetch();
+    }
+
+    return $this->row[$offset];
+  }
+
+  public function __isset($name)
+  {
+    $args = func_get_args();
+
+    $options = array();
+    if (1 < count($args))
+    {
+      $options = $args[1];
+    }
+
+    $offset = 0;
+    foreach ($this->tables as $table)
+    {
+      foreach ($table->getColumns() as $column)
+      {
+        if ($name == $column->getPhpName())
+        {
+          return null !== $this->rowOffsetGet($name, $offset, $options);
+        }
+
+        if ($name.'Id' == $column->getPhpName())
+        {
+          return null !== $this->rowOffsetGet($name.'Id', $offset, $options);
+        }
+
+        $offset++;
+      }
+    }
+
+    throw new sfException('Unknown record property "'.$name.'" on 
"'.get_class($this).'"');
+  }
+
+  public function offsetExists($offset)
+  {
+    $args = func_get_args();
+
+    return call_user_func_array(array($this, '__isset'), $args);
+  }
+
+  public function __get($name)
+  {
+    $args = func_get_args();
+
+    $options = array();
+    if (1 < count($args))
+    {
+      $options = $args[1];
+    }
+
+    $offset = 0;
+    foreach ($this->tables as $table)
+    {
+      foreach ($table->getColumns() as $column)
+      {
+        if ($name == $column->getPhpName())
+        {
+          return $this->rowOffsetGet($name, $offset, $options);
+        }
+
+        if ($name.'Id' == $column->getPhpName())
+        {
+          $relatedTable = 
$column->getTable()->getDatabaseMap()->getTable($column->getRelatedTableName());
+
+          return call_user_func(array($relatedTable->getClassName(), 
'getBy'.ucfirst($relatedTable->getColumn($column->getRelatedColumnName())->getPhpName())),
 $this->rowOffsetGet($name.'Id', $offset, $options));
+        }
+
+        $offset++;
+      }
+    }
+
+    throw new sfException('Unknown record property "'.$name.'" on 
"'.get_class($this).'"');
+  }
+
+  public function offsetGet($offset)
+  {
+    $args = func_get_args();
+
+    return call_user_func_array(array($this, '__get'), $args);
+  }
+
+  public function __set($name, $value)
+  {
+    $args = func_get_args();
+
+    $options = array();
+    if (2 < count($args))
+    {
+      $options = $args[2];
+    }
+
+    $offset = 0;
+    foreach ($this->tables as $table)
+    {
+      foreach ($table->getColumns() as $column)
+      {
+        if ($name == $column->getPhpName())
+        {
+          $this->values[$name] = $value;
+        }
+
+        if ($name.'Id' == $column->getPhpName())
+        {
+          $relatedTable = 
$column->getTable()->getDatabaseMap()->getTable($column->getRelatedTableName());
+
+          $this->values[$name.'Id'] = 
$value->__get($relatedTable->getColumn($column->getRelatedColumnName())->getPhpName(),
 $options);
+        }
+
+        $offset++;
+      }
+    }
+
+    return $this;
+  }
+
+  public function offsetSet($offset, $value)
+  {
+    $args = func_get_args();
+
+    return call_user_func_array(array($this, '__set'), $args);
+  }
+
+  public function __unset($name)
+  {
+    $offset = 0;
+    foreach ($this->tables as $table)
+    {
+      foreach ($table->getColumns() as $column)
+      {
+        if ($name == $column->getPhpName())
+        {
+          $this->values[$name] = null;
+        }
+
+        if ($name.'Id' == $column->getPhpName())
+        {
+          $this->values[$name.'Id'] = null;
+        }
+
+        $offset++;
+      }
+    }
+
+    return $this;
+  }
+
+  public function offsetUnset($offset)
+  {
+    $args = func_get_args();
+
+    return call_user_func_array(array($this, '__unset'), $args);
+  }
+
+  public function clear()
+  {
+    $this->row = $this->values = array();
+
+    return $this;
+  }
+
+  protected
+    $new = true;
+
+  protected
+    $deleted = false;
+
+  public function save($connection = null)
+  {
+    if ($this->deleted)
+    {
+      throw new PropelException('You cannot save an object that has been 
deleted.');
+    }
+
+    if ($this->new)
+    {
+      $this->insert($connection);
+    }
+    else
+    {
+      $this->update($connection);
+    }
+
+    $offset = 0;
+    foreach ($this->tables as $table)
+    {
+      foreach ($table->getColumns() as $column)
+      {
+        if (array_key_exists($column->getPhpName(), $this->values))
+        {
+          $this->row[$offset] = $this->values[$column->getPhpName()];
+        }
+
+        $offset++;
+      }
+    }
+
+    $this->new = false;
+    $this->values = array();
+
+    return $this;
+  }
+
+  protected function insert($connection = null)
+  {
+    if (!isset($connection))
+    {
+      $connection = 
QubitTransactionFilter::getConnection(QubitOtherNameI18n::DATABASE_NAME);
+    }
+
+    $offset = 0;
+    foreach ($this->tables as $table)
+    {
+      $criteria = new Criteria;
+      foreach ($table->getColumns() as $column)
+      {
+        if (!array_key_exists($column->getPhpName(), $this->values))
+        {
+          if ('createdAt' == $column->getPhpName() || 'updatedAt' == 
$column->getPhpName())
+          {
+            $this->values[$column->getPhpName()] = new DateTime;
+          }
+
+          if ('sourceCulture' == $column->getPhpName())
+          {
+            $this->values['sourceCulture'] = sfPropel::getDefaultCulture();
+          }
+        }
+
+        if (array_key_exists($column->getPhpName(), $this->values))
+        {
+          $criteria->add($column->getFullyQualifiedName(), 
$this->values[$column->getPhpName()]);
+        }
+
+        $offset++;
+      }
+
+      if (null !== $id = BasePeer::doInsert($criteria, $connection))
+      {
+                        if ($this->tables[0] == $table)
+        {
+          $columns = $table->getPrimaryKeyColumns();
+          $this->values[$columns[0]->getPhpName()] = $id;
+        }
+      }
+    }
+
+    return $this;
+  }
+
+  protected function update($connection = null)
+  {
+    if (!isset($connection))
+    {
+      $connection = 
QubitTransactionFilter::getConnection(QubitOtherNameI18n::DATABASE_NAME);
+    }
+
+    $offset = 0;
+    foreach ($this->tables as $table)
+    {
+      $criteria = new Criteria;
+      $selectCriteria = new Criteria;
+      foreach ($table->getColumns() as $column)
+      {
+        if (!array_key_exists($column->getPhpName(), $this->values))
+        {
+          if ('updatedAt' == $column->getPhpName())
+          {
+            $this->values['updatedAt'] = new DateTime;
+          }
+        }
+
+        if (array_key_exists($column->getPhpName(), $this->values))
+        {
+          if ('serialNumber' == $column->getPhpName())
+          {
+            $selectCriteria->add($column->getFullyQualifiedName(), 
$this->values[$column->getPhpName()]++);
+          }
+
+          $criteria->add($column->getFullyQualifiedName(), 
$this->values[$column->getPhpName()]);
+        }
+
+        if ($column->isPrimaryKey())
+        {
+          $selectCriteria->add($column->getFullyQualifiedName(), 
$this->row[$offset]);
+        }
+
+        $offset++;
+      }
+
+      if ($criteria->size() > 0)
+      {
+        BasePeer::doUpdate($selectCriteria, $criteria, $connection);
+      }
+    }
+
+    return $this;
+  }
+
+  public function delete($connection = null)
+  {
+    if ($this->deleted)
+    {
+      throw new PropelException('This object has already been deleted.');
+    }
+
+    $criteria = new Criteria;
+    $criteria->add(QubitOtherNameI18n::ID, $this->id);
+    $criteria->add(QubitOtherNameI18n::CULTURE, $this->culture);
+
+    self::doDelete($criteria, $connection);
+
+    $this->deleted = true;
+
+    return $this;
+  }
+
+       
+       public function getPrimaryKey()
+       {
+               $pks = array();
+
+               $pks[0] = $this->getid();
+
+               $pks[1] = $this->getculture();
+
+               return $pks;
+       }
+
+       
+       public function setPrimaryKey($keys)
+       {
+
+               $this->setid($keys[0]);
+
+               $this->setculture($keys[1]);
+
+       }
+
+  public static function addJoinotherNameCriteria(Criteria $criteria)
+  {
+    $criteria->addJoin(QubitOtherNameI18n::ID, QubitOtherName::ID);
+
+    return $criteria;
+  }
+
+  public function __call($name, $args)
+  {
+    if ('get' == substr($name, 0, 3) || 'set' == substr($name, 0, 3))
+    {
+      $args = array_merge(array(strtolower(substr($name, 3, 1)).substr($name, 
4)), $args);
+
+      return call_user_func_array(array($this, '__'.substr($name, 0, 3)), 
$args);
+    }
+
+    throw new sfException('Call to undefined method 
'.get_class($this).'::'.$name);
+  }
+}

--

You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=.


Reply via email to