new faker entries

new category view
This commit is contained in:
Etienne Roudeix
2013-08-13 11:40:24 +02:00
parent b9bc56a748
commit c9485075d4
7 changed files with 256 additions and 199 deletions

View File

@@ -891,6 +891,10 @@ abstract class Accessory implements ActiveRecordInterface
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = AccessoryTableMap::ID;
if (null !== $this->id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . AccessoryTableMap::ID . ')');
}
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(AccessoryTableMap::ID)) {
@@ -948,6 +952,13 @@ abstract class Accessory implements ActiveRecordInterface
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), 0, $e);
}
try {
$pk = $con->lastInsertId();
} catch (Exception $e) {
throw new PropelException('Unable to get autoincrement id.', 0, $e);
}
$this->setId($pk);
$this->setNew(false);
}
@@ -1224,7 +1235,6 @@ abstract class Accessory implements ActiveRecordInterface
*/
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setId($this->getId());
$copyObj->setProductId($this->getProductId());
$copyObj->setAccessory($this->getAccessory());
$copyObj->setPosition($this->getPosition());
@@ -1232,6 +1242,7 @@ abstract class Accessory implements ActiveRecordInterface
$copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) {
$copyObj->setNew(true);
$copyObj->setId(NULL); // this is a auto-increment column, so set to default value
}
}

View File

@@ -148,7 +148,7 @@ class AccessoryTableMap extends TableMap
$this->setPhpName('Accessory');
$this->setClassName('\\Thelia\\Model\\Accessory');
$this->setPackage('Thelia.Model');
$this->setUseIdGenerator(false);
$this->setUseIdGenerator(true);
$this->setIsCrossRef(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
@@ -429,6 +429,10 @@ class AccessoryTableMap extends TableMap
$criteria = $criteria->buildCriteria(); // build Criteria from Accessory object
}
if ($criteria->containsKey(AccessoryTableMap::ID) && $criteria->keyContainsValue(AccessoryTableMap::ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.AccessoryTableMap::ID.')');
}
// Set the correct dbName
$query = AccessoryQuery::create()->mergeWith($criteria);