/**
* Inserts a record into database.
*
* This method inserts a transient record in the database, and adds it
* to the identity map of its correspondent table. It proxies to @see
* processSingleInsert(), trigger insert hooks and validation of data
* if required.
*
* @param Doctrine_Record $record
* @return boolean false if record is not valid
*/
public function insert(Doctrine_Record $record)
{
$event = $record->invokeSaveHooks('pre', 'insert');
if ($record->isValid(false, false)) {
$table = $record->getTable();
if (!$event->skipOperation) {
if ($table->getOption('joinedParents')) {
// just for bc!
$this->_insertCTIRecord($table, $record);
//--
} else {
$this->processSingleInsert($record);
}
}
$table->addRecord($record);
$record->invokeSaveHooks('post', 'insert', $event);
return true;
}
return false;
}