rewriting tables
This commit is contained in:
@@ -1017,6 +1017,10 @@ abstract class RewritingUrl implements ActiveRecordInterface
|
||||
$modifiedColumns = array();
|
||||
$index = 0;
|
||||
|
||||
$this->modifiedColumns[] = RewritingUrlTableMap::ID;
|
||||
if (null !== $this->id) {
|
||||
throw new PropelException('Cannot insert a value for auto-increment primary key (' . RewritingUrlTableMap::ID . ')');
|
||||
}
|
||||
|
||||
// check the columns in natural order for more readable SQL queries
|
||||
if ($this->isColumnModified(RewritingUrlTableMap::ID)) {
|
||||
@@ -1086,6 +1090,13 @@ abstract class RewritingUrl 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);
|
||||
}
|
||||
|
||||
@@ -1383,7 +1394,6 @@ abstract class RewritingUrl implements ActiveRecordInterface
|
||||
*/
|
||||
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
|
||||
{
|
||||
$copyObj->setId($this->getId());
|
||||
$copyObj->setUrl($this->getUrl());
|
||||
$copyObj->setView($this->getView());
|
||||
$copyObj->setViewId($this->getViewId());
|
||||
@@ -1413,6 +1423,7 @@ abstract class RewritingUrl implements ActiveRecordInterface
|
||||
|
||||
if ($makeNew) {
|
||||
$copyObj->setNew(true);
|
||||
$copyObj->setId(NULL); // this is a auto-increment column, so set to default value
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user