Author: sevein
Date: Wed Sep  7 10:45:27 2011
New Revision: 9683

Log:
Restore keymap table, I shouldn't have removed that. Commit latest SQL schema.

Added:
   trunk/lib/model/QubitKeymap.php
   trunk/lib/model/map/KeymapTableMap.php
   trunk/lib/model/om/BaseKeymap.php
Modified:
   trunk/config/schema.yml
   trunk/data/sql/lib.model.schema.sql

Modified: trunk/config/schema.yml
==============================================================================
--- trunk/config/schema.yml     Tue Sep  6 17:27:34 2011        (r9682)
+++ trunk/config/schema.yml     Wed Sep  7 10:45:27 2011        (r9683)
@@ -141,6 +141,12 @@
     sources: longvarchar
     revision_history: longvarchar
 
+  keymap:
+    source_id: integer
+    target_id: integer
+    source_name: longvarchar
+    target_name: longvarchar
+
   menu:
     parent_id: { type: integer, foreignTable: menu, foreignReference: id, 
onDelete: cascade }
     name: varchar(255)

Modified: trunk/data/sql/lib.model.schema.sql
==============================================================================
--- trunk/data/sql/lib.model.schema.sql Tue Sep  6 17:27:34 2011        (r9682)
+++ trunk/data/sql/lib.model.schema.sql Wed Sep  7 10:45:27 2011        (r9683)
@@ -315,32 +315,6 @@
 )Engine=InnoDB;
 
 #-----------------------------------------------------------------------------
-#-- historical_event
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `historical_event`;
-
-
-CREATE TABLE `historical_event`
-(
-       `id` INTEGER  NOT NULL,
-       `type_id` INTEGER,
-       `start_date` DATE,
-       `start_time` TIME,
-       `end_date` DATE,
-       `end_time` TIME,
-       PRIMARY KEY (`id`),
-       CONSTRAINT `historical_event_FK_1`
-               FOREIGN KEY (`id`)
-               REFERENCES `term` (`id`)
-               ON DELETE CASCADE,
-       INDEX `historical_event_FI_2` (`type_id`),
-       CONSTRAINT `historical_event_FK_2`
-               FOREIGN KEY (`type_id`)
-               REFERENCES `term` (`id`)
-)Engine=InnoDB;
-
-#-----------------------------------------------------------------------------
 #-- information_object
 #-----------------------------------------------------------------------------
 
@@ -446,57 +420,16 @@
 
 CREATE TABLE `keymap`
 (
-       `source_id` VARCHAR(255),
+       `source_id` INTEGER,
        `target_id` INTEGER,
-       `source` VARCHAR(255),
-       `target` VARCHAR(255),
-       `id` INTEGER  NOT NULL AUTO_INCREMENT,
-       `serial_number` INTEGER default 0 NOT NULL,
-       PRIMARY KEY (`id`),
-       KEY `keymap_I_1`(`source_id`),
-       KEY `keymap_I_2`(`target_id`),
-       KEY `keymap_I_3`(`source`),
-       KEY `keymap_I_4`(`target`)
-)Engine=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- map
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `map`;
-
-
-CREATE TABLE `map`
-(
-       `created_at` DATETIME  NOT NULL,
-       `updated_at` DATETIME  NOT NULL,
-       `source_culture` VARCHAR(7)  NOT NULL,
+       `source_name` TEXT,
+       `target_name` TEXT,
        `id` INTEGER  NOT NULL AUTO_INCREMENT,
        `serial_number` INTEGER default 0 NOT NULL,
        PRIMARY KEY (`id`)
 )Engine=InnoDB;
 
 #-----------------------------------------------------------------------------
-#-- map_i18n
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `map_i18n`;
-
-
-CREATE TABLE `map_i18n`
-(
-       `title` VARCHAR(255),
-       `description` TEXT,
-       `id` INTEGER  NOT NULL,
-       `culture` VARCHAR(7)  NOT NULL,
-       PRIMARY KEY (`id`,`culture`),
-       CONSTRAINT `map_i18n_FK_1`
-               FOREIGN KEY (`id`)
-               REFERENCES `map` (`id`)
-               ON DELETE CASCADE
-)Engine=InnoDB;
-
-#-----------------------------------------------------------------------------
 #-- menu
 #-----------------------------------------------------------------------------
 
@@ -793,99 +726,6 @@
 )Engine=InnoDB;
 
 #-----------------------------------------------------------------------------
-#-- place
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `place`;
-
-
-CREATE TABLE `place`
-(
-       `id` INTEGER  NOT NULL,
-       `country_id` INTEGER,
-       `type_id` INTEGER,
-       `longtitude` FLOAT,
-       `latitude` FLOAT,
-       `altitude` FLOAT,
-       `source_culture` VARCHAR(7)  NOT NULL,
-       PRIMARY KEY (`id`),
-       CONSTRAINT `place_FK_1`
-               FOREIGN KEY (`id`)
-               REFERENCES `term` (`id`)
-               ON DELETE CASCADE,
-       INDEX `place_FI_2` (`country_id`),
-       CONSTRAINT `place_FK_2`
-               FOREIGN KEY (`country_id`)
-               REFERENCES `term` (`id`),
-       INDEX `place_FI_3` (`type_id`),
-       CONSTRAINT `place_FK_3`
-               FOREIGN KEY (`type_id`)
-               REFERENCES `term` (`id`)
-)Engine=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- place_i18n
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `place_i18n`;
-
-
-CREATE TABLE `place_i18n`
-(
-       `street_address` TEXT,
-       `city` VARCHAR(255),
-       `region` VARCHAR(255),
-       `postal_code` VARCHAR(255),
-       `id` INTEGER  NOT NULL,
-       `culture` VARCHAR(7)  NOT NULL,
-       PRIMARY KEY (`id`,`culture`),
-       CONSTRAINT `place_i18n_FK_1`
-               FOREIGN KEY (`id`)
-               REFERENCES `place` (`id`)
-               ON DELETE CASCADE
-)Engine=InnoDB;
-
-#-----------------------------------------------------------------------------
-#-- place_map_relation
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `place_map_relation`;
-
-
-CREATE TABLE `place_map_relation`
-(
-       `id` INTEGER  NOT NULL,
-       `place_id` INTEGER  NOT NULL,
-       `map_id` INTEGER  NOT NULL,
-       `map_icon_image_id` INTEGER,
-       `map_icon_description` TEXT,
-       `type_id` INTEGER,
-       PRIMARY KEY (`id`),
-       CONSTRAINT `place_map_relation_FK_1`
-               FOREIGN KEY (`id`)
-               REFERENCES `object` (`id`)
-               ON DELETE CASCADE,
-       INDEX `place_map_relation_FI_2` (`place_id`),
-       CONSTRAINT `place_map_relation_FK_2`
-               FOREIGN KEY (`place_id`)
-               REFERENCES `place` (`id`)
-               ON DELETE CASCADE,
-       INDEX `place_map_relation_FI_3` (`map_id`),
-       CONSTRAINT `place_map_relation_FK_3`
-               FOREIGN KEY (`map_id`)
-               REFERENCES `map` (`id`)
-               ON DELETE CASCADE,
-       INDEX `place_map_relation_FI_4` (`map_icon_image_id`),
-       CONSTRAINT `place_map_relation_FK_4`
-               FOREIGN KEY (`map_icon_image_id`)
-               REFERENCES `digital_object` (`id`),
-       INDEX `place_map_relation_FI_5` (`type_id`),
-       CONSTRAINT `place_map_relation_FK_5`
-               FOREIGN KEY (`type_id`)
-               REFERENCES `term` (`id`)
-)Engine=InnoDB;
-
-#-----------------------------------------------------------------------------
 #-- property
 #-----------------------------------------------------------------------------
 
@@ -1270,37 +1110,6 @@
 )Engine=InnoDB;
 
 #-----------------------------------------------------------------------------
-#-- system_event
-#-----------------------------------------------------------------------------
-
-DROP TABLE IF EXISTS `system_event`;
-
-
-CREATE TABLE `system_event`
-(
-       `type_id` INTEGER,
-       `object_class` VARCHAR(255),
-       `object_id` INTEGER,
-       `pre_event_snapshot` TEXT,
-       `post_event_snapshot` TEXT,
-       `date` DATETIME,
-       `user_id` INTEGER,
-       `created_at` DATETIME  NOT NULL,
-       `updated_at` DATETIME  NOT NULL,
-       `id` INTEGER  NOT NULL AUTO_INCREMENT,
-       `serial_number` INTEGER default 0 NOT NULL,
-       PRIMARY KEY (`id`),
-       INDEX `system_event_FI_1` (`type_id`),
-       CONSTRAINT `system_event_FK_1`
-               FOREIGN KEY (`type_id`)
-               REFERENCES `term` (`id`),
-       INDEX `system_event_FI_2` (`user_id`),
-       CONSTRAINT `system_event_FK_2`
-               FOREIGN KEY (`user_id`)
-               REFERENCES `user` (`id`)
-)Engine=InnoDB;
-
-#-----------------------------------------------------------------------------
 #-- taxonomy
 #-----------------------------------------------------------------------------
 

Added: trunk/lib/model/QubitKeymap.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/lib/model/QubitKeymap.php     Wed Sep  7 10:45:27 2011        (r9683)
@@ -0,0 +1,22 @@
+<?php
+
+/*
+ * This file is part of Qubit Toolkit.
+ *
+ * Qubit Toolkit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Qubit Toolkit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Qubit Toolkit.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+class QubitKeymap extends BaseKeymap
+{
+}

Added: trunk/lib/model/map/KeymapTableMap.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/lib/model/map/KeymapTableMap.php      Wed Sep  7 10:45:27 2011        
(r9683)
@@ -0,0 +1,55 @@
+<?php
+
+
+/**
+ * This class defines the structure of the 'keymap' table.
+ *
+ *
+ *
+ * This map class is used by Propel to do runtime db structure discovery.
+ * For example, the createSelectSql() method checks the type of a given column 
used in an
+ * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY 
case-insensitive
+ * (i.e. if it's a text column type).
+ *
+ * @package    lib.model.map
+ */
+class KeymapTableMap extends TableMap {
+
+       /**
+        * The (dot-path) name of this class
+        */
+       const CLASS_NAME = 'lib.model.map.KeymapTableMap';
+
+       /**
+        * Initialize the table attributes, columns and validators
+        * Relations are not initialized by this method since they are lazy 
loaded
+        *
+        * @return     void
+        * @throws     PropelException
+        */
+       public function initialize()
+       {
+         // attributes
+               $this->setName('keymap');
+               $this->setPhpName('keymap');
+               $this->setClassname('QubitKeymap');
+               $this->setPackage('lib.model');
+               $this->setUseIdGenerator(true);
+               // columns
+               $this->addColumn('SOURCE_ID', 'sourceId', 'INTEGER', false, 
null, null);
+               $this->addColumn('TARGET_ID', 'targetId', 'INTEGER', false, 
null, null);
+               $this->addColumn('SOURCE_NAME', 'sourceName', 'LONGVARCHAR', 
false, null, null);
+               $this->addColumn('TARGET_NAME', 'targetName', 'LONGVARCHAR', 
false, null, null);
+               $this->addPrimaryKey('ID', 'id', 'INTEGER', true, null, null);
+               $this->addColumn('SERIAL_NUMBER', 'serialNumber', 'INTEGER', 
true, null, 0);
+               // validators
+       } // initialize()
+
+       /**
+        * Build the RelationMap objects for this table relationships
+        */
+       public function buildRelations()
+       {
+       } // buildRelations()
+
+} // KeymapTableMap

Added: trunk/lib/model/om/BaseKeymap.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/lib/model/om/BaseKeymap.php   Wed Sep  7 10:45:27 2011        (r9683)
@@ -0,0 +1,533 @@
+<?php
+
+abstract class BaseKeymap implements ArrayAccess
+{
+  const
+    DATABASE_NAME = 'propel',
+
+    TABLE_NAME = 'keymap',
+
+    SOURCE_ID = 'keymap.SOURCE_ID',
+    TARGET_ID = 'keymap.TARGET_ID',
+    SOURCE_NAME = 'keymap.SOURCE_NAME',
+    TARGET_NAME = 'keymap.TARGET_NAME',
+    ID = 'keymap.ID',
+    SERIAL_NUMBER = 'keymap.SERIAL_NUMBER';
+
+  public static function addSelectColumns(Criteria $criteria)
+  {
+    $criteria->addSelectColumn(QubitKeymap::SOURCE_ID);
+    $criteria->addSelectColumn(QubitKeymap::TARGET_ID);
+    $criteria->addSelectColumn(QubitKeymap::SOURCE_NAME);
+    $criteria->addSelectColumn(QubitKeymap::TARGET_NAME);
+    $criteria->addSelectColumn(QubitKeymap::ID);
+    $criteria->addSelectColumn(QubitKeymap::SERIAL_NUMBER);
+
+    return $criteria;
+  }
+
+  protected static
+    $keymaps = array();
+
+  protected
+    $keys = array(),
+    $row = array();
+
+  public static function getFromRow(array $row)
+  {
+    $keys = array();
+    $keys['id'] = $row[4];
+
+    $key = serialize($keys);
+    if (!isset(self::$keymaps[$key]))
+    {
+      $keymap = new QubitKeymap;
+
+      $keymap->keys = $keys;
+      $keymap->row = $row;
+
+      $keymap->new = false;
+
+      self::$keymaps[$key] = $keymap;
+    }
+
+    return self::$keymaps[$key];
+  }
+
+  public static function get(Criteria $criteria, array $options = array())
+  {
+    if (!isset($options['connection']))
+    {
+      $options['connection'] = 
Propel::getConnection(QubitKeymap::DATABASE_NAME);
+    }
+
+    self::addSelectColumns($criteria);
+
+    return QubitQuery::createFromCriteria($criteria, 'QubitKeymap', $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(QubitKeymap::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(QubitKeymap::DATABASE_NAME);
+    }
+
+    $affectedRows = 0;
+
+    $affectedRows += BasePeer::doDelete($criteria, $connection);
+
+    return $affectedRows;
+  }
+
+  protected
+    $tables = array();
+
+  public function __construct()
+  {
+    $this->tables[] = 
Propel::getDatabaseMap(QubitKeymap::DATABASE_NAME)->getTable(QubitKeymap::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(QubitKeymap::DATABASE_NAME);
+      }
+
+      $criteria = new Criteria;
+      $criteria->add(QubitKeymap::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++;
+      }
+    }
+
+    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 param($column)
+  {
+    $value = $this->values[$column->getPhpName()];
+
+    // Convert to DateTime or SQL zero special case
+    if (isset($value) && $column->isTemporal() && !$value instanceof DateTime)
+    {
+      // Year only: one or more digits.  Convert to SQL zero special case
+      if (preg_match('/^\d+$/', $value))
+      {
+        $value .= '-0-0';
+      }
+
+      // Year and month only: one or more digits, plus separator, plus
+      // one or more digits.  Convert to SQL zero special case
+      else if (preg_match('/^\d+[-\/]\d+$/', $value))
+      {
+        $value .= '-0';
+      }
+
+      // Convert to DateTime if not SQL zero special case: year plus
+      // separator plus zero to twelve (possibly zero padded) plus
+      // separator plus one or more zeros
+      if (!preg_match('/^\d+[-\/]0*(?:1[0-2]|\d)[-\/]0+$/', $value))
+      {
+        $value = new DateTime($value);
+      }
+    }
+
+    return $value;
+  }
+
+  protected function insert($connection = null)
+  {
+    if (!isset($connection))
+    {
+      $connection = 
QubitTransactionFilter::getConnection(QubitKeymap::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->param($column));
+        }
+
+        $offset++;
+      }
+
+      if (null !== $id = BasePeer::doInsert($criteria, $connection))
+      {
+        // Guess that the first primary key of the first table is auto
+        // incremented
+        if ($this->tables[0] == $table)
+        {
+          $columns = $table->getPrimaryKeyColumns();
+          $this->values[$columns[0]->getPhpName()] = 
$this->keys[$columns[0]->getPhpName()] = $id;
+        }
+      }
+    }
+
+    return $this;
+  }
+
+  protected function update($connection = null)
+  {
+    if (!isset($connection))
+    {
+      $connection = 
QubitTransactionFilter::getConnection(QubitKeymap::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->param($column));
+        }
+
+        if ($column->isPrimaryKey())
+        {
+          $selectCriteria->add($column->getFullyQualifiedName(), 
$this->keys[$column->getPhpName()]);
+        }
+
+        $offset++;
+      }
+
+      if (0 < $criteria->size())
+      {
+        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(QubitKeymap::ID, $this->id);
+
+    self::doDelete($criteria, $connection);
+
+    $this->deleted = true;
+
+    return $this;
+  }
+
+       /**
+        * Returns the primary key for this object (row).
+        * @return     int
+        */
+       public function getPrimaryKey()
+       {
+               return $this->getid();
+       }
+
+       /**
+        * Generic method to set the primary key (id column).
+        *
+        * @param      int $key Primary key.
+        * @return     void
+        */
+       public function setPrimaryKey($key)
+       {
+               $this->setid($key);
+       }
+
+  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=en.

Reply via email to