當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BasePeer::doInsert方法代碼示例

本文整理匯總了PHP中BasePeer::doInsert方法的典型用法代碼示例。如果您正苦於以下問題:PHP BasePeer::doInsert方法的具體用法?PHP BasePeer::doInsert怎麽用?PHP BasePeer::doInsert使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BasePeer的用法示例。


在下文中一共展示了BasePeer::doInsert方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testDoInsert

 public function testDoInsert()
 {
     try {
         $c = new Criteria();
         $c->setPrimaryTableName(BookPeer::TABLE_NAME);
         $c->add(BookPeer::AUTHOR_ID, 'lkhlkhj');
         BasePeer::doInsert($c, Propel::getConnection());
     } catch (PropelException $e) {
         $this->assertContains('[INSERT INTO `book` (`AUTHOR_ID`) VALUES (:p1)]', $e->getMessage(), 'SQL query is written in the exception message');
     }
 }
開發者ID:dracony,項目名稱:forked-php-orm-benchmark,代碼行數:11,代碼來源:BasePeerExceptionsTest.php

示例2: insert

 protected function insert($connection = null)
 {
     if (!isset($connection)) {
         $connection = QubitTransactionFilter::getConnection(QubitOaiHarvest::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)) {
                 if (null !== ($param = $this->param($column))) {
                     $criteria->add($column->getFullyQualifiedName(), $param);
                 }
             }
             $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;
 }
開發者ID:nurfiantara,項目名稱:ehri-ica-atom,代碼行數:35,代碼來源:BaseOaiHarvest.php

示例3: doSave

 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      PropelPDO $con
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws     PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // If this object has been modified, then save it to the database.
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $criteria = $this->buildCriteria();
                 $pk = BasePeer::doInsert($criteria, $con);
                 $affectedRows = 1;
                 $this->setNew(false);
             } else {
                 $affectedRows = ReservationItemRightsPeer::doUpdate($this, $con);
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
開發者ID:raulito1500,項目名稱:mdokeos,代碼行數:34,代碼來源:BaseReservationItemRights.php

示例4: doInsert

 /**
  * Performs an INSERT on the database, given a SubscriberGroupMembership or Criteria object.
  *
  * @param      mixed $values Criteria or SubscriberGroupMembership object containing data that is used to create the INSERT statement.
  * @param      PropelPDO $con the PropelPDO connection to use
  * @return mixed           The new primary key.
  * @throws PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doInsert($values, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(SubscriberGroupMembershipPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     if ($values instanceof Criteria) {
         $criteria = clone $values;
         // rename for clarity
     } else {
         $criteria = $values->buildCriteria();
         // build Criteria from SubscriberGroupMembership object
     }
     // Set the correct dbName
     $criteria->setDbName(SubscriberGroupMembershipPeer::DATABASE_NAME);
     try {
         // use transaction because $criteria could contain info
         // for more than one table (I guess, conceivably)
         $con->beginTransaction();
         $pk = BasePeer::doInsert($criteria, $con);
         $con->commit();
     } catch (Exception $e) {
         $con->rollBack();
         throw $e;
     }
     return $pk;
 }
開發者ID:rapila,項目名稱:plugin-newsletter,代碼行數:35,代碼來源:BaseSubscriberGroupMembershipPeer.php

示例5: doInsert

 /**
  * Method perform an INSERT on the database, given a MetadataProfile or Criteria object.
  *
  * @param      mixed $values Criteria or MetadataProfile object containing data that is used to create the INSERT statement.
  * @param      PropelPDO $con the PropelPDO connection to use
  * @return     mixed The new primary key.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doInsert($values, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(MetadataProfilePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     if ($values instanceof Criteria) {
         $criteria = clone $values;
         // rename for clarity
     } else {
         $criteria = $values->buildCriteria();
         // build Criteria from MetadataProfile object
     }
     if ($criteria->containsKey(MetadataProfilePeer::ID) && $criteria->keyContainsValue(MetadataProfilePeer::ID)) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . MetadataProfilePeer::ID . ')');
     }
     // Set the correct dbName
     $criteria->setDbName(self::DATABASE_NAME);
     try {
         // use transaction because $criteria could contain info
         // for more than one table (I guess, conceivably)
         $con->beginTransaction();
         $pk = BasePeer::doInsert($criteria, $con);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
     return $pk;
 }
開發者ID:DBezemer,項目名稱:server,代碼行數:38,代碼來源:BaseMetadataProfilePeer.php

示例6: doInsert

 /**
  * Method perform an INSERT on the database, given a ExamCommentDig or Criteria object.
  *
  * @param      mixed $values Criteria or ExamCommentDig object containing data that is used to create the INSERT statement.
  * @param      PropelPDO $con the PropelPDO connection to use
  * @return     mixed The new primary key.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doInsert($values, PropelPDO $con = null)
 {
     foreach (sfMixer::getCallables('BaseExamCommentDigPeer:doInsert:pre') as $callable) {
         $ret = call_user_func($callable, 'BaseExamCommentDigPeer', $values, $con);
         if (false !== $ret) {
             return $ret;
         }
     }
     if ($con === null) {
         $con = Propel::getConnection(ExamCommentDigPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     if ($values instanceof Criteria) {
         $criteria = clone $values;
         // rename for clarity
     } else {
         $criteria = $values->buildCriteria();
         // build Criteria from ExamCommentDig object
     }
     // Set the correct dbName
     $criteria->setDbName(self::DATABASE_NAME);
     try {
         // use transaction because $criteria could contain info
         // for more than one table (I guess, conceivably)
         $con->beginTransaction();
         $pk = BasePeer::doInsert($criteria, $con);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
     foreach (sfMixer::getCallables('BaseExamCommentDigPeer:doInsert:post') as $callable) {
         call_user_func($callable, 'BaseExamCommentDigPeer', $values, $con, $pk);
     }
     return $pk;
 }
開發者ID:rafd,項目名稱:SkuleCourses,代碼行數:44,代碼來源:BaseExamCommentDigPeer.php

示例7: doInsert

 /**
  * Method perform an INSERT on the database, given a UserStatEquip or Criteria object.
  *
  * @param      mixed $values Criteria or UserStatEquip object containing data that is used to create the INSERT statement.
  * @param      PropelPDO $con the PropelPDO connection to use
  * @return     mixed The new primary key.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doInsert($values, PropelPDO $con = null)
 {
     foreach (sfMixer::getCallables('BaseUserStatEquipPeer:doInsert:pre') as $callable) {
         $ret = call_user_func($callable, 'BaseUserStatEquipPeer', $values, $con);
         if (false !== $ret) {
             return $ret;
         }
     }
     if ($con === null) {
         $con = Propel::getConnection(UserStatEquipPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     if ($values instanceof Criteria) {
         $criteria = clone $values;
         // rename for clarity
     } else {
         $criteria = $values->buildCriteria();
         // build Criteria from UserStatEquip object
     }
     if ($criteria->containsKey(UserStatEquipPeer::USER_STAT_EQUIP_ID) && $criteria->keyContainsValue(UserStatEquipPeer::USER_STAT_EQUIP_ID)) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . UserStatEquipPeer::USER_STAT_EQUIP_ID . ')');
     }
     // Set the correct dbName
     $criteria->setDbName(self::DATABASE_NAME);
     try {
         // use transaction because $criteria could contain info
         // for more than one table (I guess, conceivably)
         $con->beginTransaction();
         $pk = BasePeer::doInsert($criteria, $con);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
     foreach (sfMixer::getCallables('BaseUserStatEquipPeer:doInsert:post') as $callable) {
         call_user_func($callable, 'BaseUserStatEquipPeer', $values, $con, $pk);
     }
     return $pk;
 }
開發者ID:broschb,項目名稱:cyclebrain,代碼行數:47,代碼來源:BaseUserStatEquipPeer.php

示例8: doInsert

 /**
  * Method perform an INSERT on the database, given a PcBlogComment or Criteria object.
  *
  * @param      mixed $values Criteria or PcBlogComment object containing data that is used to create the INSERT statement.
  * @param      PropelPDO $con the PropelPDO connection to use
  * @return     mixed The new primary key.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doInsert($values, PropelPDO $con = null)
 {
     // symfony_behaviors behavior
     foreach (sfMixer::getCallables('BasePcBlogCommentPeer:doInsert:pre') as $sf_hook) {
         if (false !== ($sf_hook_retval = call_user_func($sf_hook, 'BasePcBlogCommentPeer', $values, $con))) {
             return $sf_hook_retval;
         }
     }
     if ($con === null) {
         $con = Propel::getConnection(PcBlogCommentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     if ($values instanceof Criteria) {
         $criteria = clone $values;
         // rename for clarity
     } else {
         $criteria = $values->buildCriteria();
         // build Criteria from PcBlogComment object
     }
     if ($criteria->containsKey(PcBlogCommentPeer::ID) && $criteria->keyContainsValue(PcBlogCommentPeer::ID)) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . PcBlogCommentPeer::ID . ')');
     }
     // Set the correct dbName
     $criteria->setDbName(self::DATABASE_NAME);
     try {
         // use transaction because $criteria could contain info
         // for more than one table (I guess, conceivably)
         $con->beginTransaction();
         $pk = BasePeer::doInsert($criteria, $con);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
     // symfony_behaviors behavior
     foreach (sfMixer::getCallables('BasePcBlogCommentPeer:doInsert:post') as $sf_hook) {
         call_user_func($sf_hook, 'BasePcBlogCommentPeer', $values, $con, $pk);
     }
     return $pk;
 }
開發者ID:ntemple,項目名稱:intelli-plancake,代碼行數:48,代碼來源:BasePcBlogCommentPeer.php

示例9: doInsert

 public static function doInsert($values, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(RelAnioActividadDocentePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     if ($values instanceof Criteria) {
         $criteria = clone $values;
     } else {
         $criteria = $values->buildCriteria();
     }
     $criteria->setDbName(self::DATABASE_NAME);
     try {
         $con->beginTransaction();
         $pk = BasePeer::doInsert($criteria, $con);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
     return $pk;
 }
開發者ID:mediasadc,項目名稱:alba,代碼行數:21,代碼來源:BaseRelAnioActividadDocentePeer.php

示例10: doInsert

 /**
  * Method perform an INSERT on the database, given a SchemaPropertyElementHistory or Criteria object.
  *
  * @param      mixed $values Criteria or SchemaPropertyElementHistory object containing data that is used to create the INSERT statement.
  * @param      Connection $con the connection to use
  * @return     mixed The new primary key.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doInsert($values, $con = null)
 {
     foreach (sfMixer::getCallables('BaseSchemaPropertyElementHistoryPeer:doInsert:pre') as $callable) {
         $ret = call_user_func($callable, 'BaseSchemaPropertyElementHistoryPeer', $values, $con);
         if (false !== $ret) {
             return $ret;
         }
     }
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     if ($values instanceof Criteria) {
         $criteria = clone $values;
         // rename for clarity
     } else {
         $criteria = $values->buildCriteria();
         // build Criteria from SchemaPropertyElementHistory object
     }
     $criteria->remove(SchemaPropertyElementHistoryPeer::ID);
     // remove pkey col since this table uses auto-increment
     // Set the correct dbName
     $criteria->setDbName(self::DATABASE_NAME);
     try {
         // use transaction because $criteria could contain info
         // for more than one table (I guess, conceivably)
         $con->begin();
         $pk = BasePeer::doInsert($criteria, $con);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollback();
         throw $e;
     }
     foreach (sfMixer::getCallables('BaseSchemaPropertyElementHistoryPeer:doInsert:post') as $callable) {
         call_user_func($callable, 'BaseSchemaPropertyElementHistoryPeer', $values, $con, $pk);
     }
     return $pk;
 }
開發者ID:jonphipps,項目名稱:Metadata-Registry,代碼行數:46,代碼來源:BaseSchemaPropertyElementHistoryPeer.php

示例11: doInsert

 public static function doInsert($values, PropelPDO $con = null)
 {
     foreach (sfMixer::getCallables('BaseProductPeer:doInsert:pre') as $callable) {
         $ret = call_user_func($callable, 'BaseProductPeer', $values, $con);
         if (false !== $ret) {
             return $ret;
         }
     }
     if ($con === null) {
         $con = Propel::getConnection(ProductPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     if ($values instanceof Criteria) {
         $criteria = clone $values;
     } else {
         $criteria = $values->buildCriteria();
     }
     if ($criteria->containsKey(ProductPeer::ID) && $criteria->keyContainsValue(ProductPeer::ID)) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . ProductPeer::ID . ')');
     }
     $criteria->setDbName(self::DATABASE_NAME);
     try {
         $con->beginTransaction();
         $pk = BasePeer::doInsert($criteria, $con);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
     foreach (sfMixer::getCallables('BaseProductPeer:doInsert:post') as $callable) {
         call_user_func($callable, 'BaseProductPeer', $values, $con, $pk);
     }
     return $pk;
 }
開發者ID:yasirgit,項目名稱:afids,代碼行數:33,代碼來源:BaseProductPeer.php

示例12: doSave

	/**
	 * Performs the work of inserting or updating the row in the database.
	 *
	 * If the object is new, it inserts it; otherwise an update is performed.
	 * All related objects are also updated in this method.
	 *
	 * @param      PropelPDO $con
	 * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
	 * @throws     PropelException
	 * @see        save()
	 */
	protected function doSave(PropelPDO $con)
	{
		$affectedRows = 0; // initialize var to track total num of affected rows
		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


			// If this object has been modified, then save it to the database.
			if ($this->isModified()) {
				if ($this->isNew()) {
					$criteria = $this->buildCriteria();
					$pk = BasePeer::doInsert($criteria, $con);
					$affectedRows = 1;
					$this->setNew(false);
				} else {
					$affectedRows = ResponsableEleveAdressePeer::doUpdate($this, $con);
				}

				$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
			}

			if ($this->collResponsableEleves !== null) {
				foreach ($this->collResponsableEleves as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collAbsenceEleveNotifications !== null) {
				foreach ($this->collAbsenceEleveNotifications as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			$this->alreadyInSave = false;

		}
		return $affectedRows;
	} // doSave()
開發者ID:rhertzog,項目名稱:lcs,代碼行數:53,代碼來源:BaseResponsableEleveAdresse.php

示例13: showImport


//.........這裏部分代碼省略.........
         if (count($nonExistent)) {
             throw new Exception('Unknown column in column list: ' . join(', ', $nonExistent));
         }
         // Open csv file
         $fileInfo = $form->file->getFileInfo();
         $fp = fopen($fileInfo['file']['tmp_name'], "r");
         if (!$fp) {
             throw new Exception('Unable to open file');
         }
         // Wrap in transaction
         $deleted = 0;
         $updated = 0;
         $inserted = 0;
         $con = Propel::getConnection(PropelQuery::from($modelClass)->getDbName());
         $con->beginTransaction();
         try {
             // Replace will empty the table
             if ($mode === self::IMPORT_REPLACE) {
                 $deleted = PropelQuery::from($modelClass)->deleteAll();
             }
             // Read csv lines
             while (($data = fgetcsv($fp, 0, $delimiter, $enclosure, $escape)) !== false) {
                 if (count($data) !== count($columns)) {
                     throw new Exception('Invalid column count ' . count($data) . ', expected ' . count($columns));
                 }
                 if ($skipFirst) {
                     $skipFirst = false;
                     continue;
                 }
                 $data = array_combine($columns, $data);
                 $pkData = array();
                 // Check for null values and collect primary key
                 foreach ($data as $k => $v) {
                     if ($v === $nullValue) {
                         $data[$k] = $v = null;
                     }
                     if (in_array($k, $pks)) {
                         $pkData[$k] = $v;
                     }
                 }
                 $obj = null;
                 if ($mode === self::IMPORT_UPDATE || $mode === self::IMPORT_UPDATE_OR_INSERT) {
                     // attempt to find existing object using pk
                     if (count($pkData) === count($pks)) {
                         $obj = new $modelClass();
                         $obj->fromArray($pkData, BasePeer::TYPE_FIELDNAME);
                         $obj = PropelQuery::from($modelClass)->findPk($obj->getPrimaryKey());
                     }
                     if (!$obj && $mode === self::IMPORT_UPDATE_OR_INSERT) {
                         // not found, create new
                         $obj = new $modelClass();
                     }
                 } else {
                     // REPLACE, APPEND
                     $obj = new $modelClass();
                 }
                 // Remove unused columns
                 foreach ($data as $k => $v) {
                     if (!in_array($k, $useColumns)) {
                         unset($data[$k]);
                     }
                 }
                 if ($obj) {
                     // Unset primary key columns in data when appending
                     if ($mode === self::IMPORT_APPEND) {
                         foreach ($pks as $pk) {
                             if (array_key_exists($pk, $data)) {
                                 unset($data[$pk]);
                             }
                         }
                     }
                     $obj->fromArray($data, BasePeer::TYPE_FIELDNAME);
                     if ($obj->isNew()) {
                         // allows insert of custom primary key
                         BasePeer::doInsert($obj->buildCriteria(), $con);
                         ++$inserted;
                     } else {
                         $updated += $obj->save();
                     }
                 }
             }
             $con->commit();
         } catch (Exception $e) {
             $con->rollBack();
             throw $e;
         }
         if ($deleted) {
             $this->addMessage('Deleted: ' . $deleted);
         }
         if ($inserted) {
             $this->addMessage('Inserted: ' . $inserted);
         }
         if ($updated) {
             $this->addMessage('Updated: ' . $updated);
         }
         $this->addMessage('All done.', self::MSG_SUCCESS);
     } else {
         $this->addMainContent($form);
     }
 }
開發者ID:varvanin,項目名稱:currycms,代碼行數:101,代碼來源:Database.php

示例14: doSave

 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      PropelPDO $con
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws     PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         if ($this->isNew()) {
             $this->modifiedColumns[] = OpenidAssociationPeer::ID;
         }
         // If this object has been modified, then save it to the database.
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $criteria = $this->buildCriteria();
                 if ($criteria->keyContainsValue(OpenidAssociationPeer::ID)) {
                     throw new PropelException('Cannot insert a value for auto-increment primary key (' . OpenidAssociationPeer::ID . ')');
                 }
                 $pk = BasePeer::doInsert($criteria, $con);
                 $affectedRows = 1;
                 $this->setId($pk);
                 //[IMV] update autoincrement primary key
                 $this->setNew(false);
             } else {
                 $affectedRows = OpenidAssociationPeer::doUpdate($this, $con);
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
開發者ID:raulito1500,項目名稱:mdokeos,代碼行數:42,代碼來源:BaseOpenidAssociation.php

示例15: doSave

 /**
  * Performs the work of inserting or updating the row in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      PropelPDO $con
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws     PropelException
  * @see        save()
  */
 protected function doSave(PropelPDO $con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aGroup !== null) {
             if ($this->aGroup->isModified() || $this->aGroup->isNew()) {
                 $affectedRows += $this->aGroup->save($con);
             }
             $this->setGroup($this->aGroup);
         }
         if ($this->aUser !== null) {
             if ($this->aUser->isModified() || $this->aUser->isNew()) {
                 $affectedRows += $this->aUser->save($con);
             }
             $this->setUser($this->aUser);
         }
         if ($this->isNew()) {
             $this->modifiedColumns[] = DirectoryPermissionPeer::ID;
         }
         // If this object has been modified, then save it to the database.
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $criteria = $this->buildCriteria();
                 if ($criteria->keyContainsValue(DirectoryPermissionPeer::ID)) {
                     throw new PropelException('Cannot insert a value for auto-increment primary key (' . DirectoryPermissionPeer::ID . ')');
                 }
                 $pk = BasePeer::doInsert($criteria, $con);
                 $affectedRows += 1;
                 $this->setId($pk);
                 //[IMV] update autoincrement primary key
                 $this->setNew(false);
             } else {
                 $affectedRows += DirectoryPermissionPeer::doUpdate($this, $con);
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
開發者ID:rapila,項目名稱:plugin-webdav,代碼行數:58,代碼來源:BaseDirectoryPermission.php


注:本文中的BasePeer::doInsert方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。