本文整理汇总了PHP中Batch::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Batch::save方法的具体用法?PHP Batch::save怎么用?PHP Batch::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Batch
的用法示例。
在下文中一共展示了Batch::save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Course();
$batch = new Batch();
// Uncomment the following line if AJAX validation is needed
$this->performAjaxValidation(array($model, $batch));
if (isset($_POST['Course'])) {
$model->attributes = $_POST['Course'];
$model->created_by = Yii::app()->user->id;
$model->created_date = new CDbExpression('NOW()');
if ($model->save()) {
if (isset($_POST['Batch'])) {
$batch->batch_name = $_POST['Batch']['batch_name'];
$batch->batch_fees = $_POST['Batch']['batch_fees'];
$batch->course_id = $model->course_id;
$batch->batch_start_date = '';
$batch->batch_end_date = '';
$batch->batch_created_by = Yii::app()->user->id;
$batch->batch_creation_date = new CDbExpression('NOW()');
$batch->save(false);
}
$this->redirect(array('view', 'id' => $model->course_id));
}
}
$this->render('create', array('model' => $model, 'batch' => $batch));
}
示例2: saveRelationship
/**
* Save the given relationship
*
* @param Relationship $rel
* @return boolean
*/
public function saveRelationship(Relationship $rel)
{
if ($this->openBatch) {
$this->openBatch->save($rel);
return true;
}
if ($rel->hasId()) {
return $this->runCommand(new Command\UpdateRelationship($this, $rel));
} else {
return $this->runCommand(new Command\CreateRelationship($this, $rel));
}
}
示例3: createBatchRecord
/**
* creates a new Batch log record
*
* @return return_type
* @param var_type $var
*/
public function createBatchRecord($batchTime, $batchDescription, $objectType, $eventDescription, $eventType, $objectId = null, $registryURI = '')
{
$batchRecord = new Batch();
$batchRecord->setRunTime($batchTime);
$batchRecord->setRunDescription($batchDescription);
$batchRecord->setObjectType($objectType);
$batchRecord->setObjectId($objectId);
$batchRecord->setEventTime(time());
$batchRecord->setEventDescription($eventDescription);
$batchRecord->setEventType($eventType);
$batchRecord->setRegistryUri($registryURI);
$batchRecord->save();
return $batchRecord;
}
示例4: testStartBatch_CommitOtherBatch_ReturnsSameBatch
public function testStartBatch_CommitOtherBatch_ReturnsSameBatch()
{
$this->transport->expects($this->once())->method('post')->with('/batch')->will($this->returnValue(array('code' => 200)));
$openBatch = $this->client->startBatch();
$batch = new Batch($this->client);
$batch->save(new Node($this->client));
$batch->commit();
$batchAgain = $this->client->startBatch();
$this->assertSame($openBatch, $batchAgain);
}
示例5: doSave
/**
* Stores the object 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 Connection $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($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->aUser !== null) {
if ($this->aUser->isModified()) {
$affectedRows += $this->aUser->save($con);
}
$this->setUser($this->aUser);
}
if ($this->aVocabulary !== null) {
if ($this->aVocabulary->isModified()) {
$affectedRows += $this->aVocabulary->save($con);
}
$this->setVocabulary($this->aVocabulary);
}
if ($this->aSchema !== null) {
if ($this->aSchema->isModified()) {
$affectedRows += $this->aSchema->save($con);
}
$this->setSchema($this->aSchema);
}
if ($this->aBatch !== null) {
if ($this->aBatch->isModified()) {
$affectedRows += $this->aBatch->save($con);
}
$this->setBatch($this->aBatch);
}
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = FileImportHistoryPeer::doInsert($this, $con);
$affectedRows += 1;
// we are assuming that there is only 1 row per doInsert() which
// should always be true here (even though technically
// BasePeer::doInsert() can insert multiple rows).
$this->setId($pk);
//[IMV] update autoincrement primary key
$this->setNew(false);
} else {
$affectedRows += FileImportHistoryPeer::doUpdate($this, $con);
}
$this->resetModified();
// [HL] After being saved an object is no longer 'modified'
}
if ($this->collConceptPropertyHistorys !== null) {
foreach ($this->collConceptPropertyHistorys as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
if ($this->collSchemaPropertyElementHistorys !== null) {
foreach ($this->collSchemaPropertyElementHistorys as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例6: createAction
/**
* Creates a product based on the data entered in the "new" action
*/
public function createAction()
{
$proxyList = $this->request->get('proxyId');
if (!parent::isValidRequest(new BatchValidation()) || empty($proxyList)) {
if (empty($proxyList)) {
$this->flash->notice('Please select at least 1 proxy.');
}
return parent::redirect('batch/new', ['proxyId' => implode(',', $this->request->get('proxyId'))]);
}
try {
$name = trim($this->request->get('name'));
$existingBatch = Batch::findFirst(array('conditions' => 'name = ?0', 'bind' => array($name)));
if ($existingBatch) {
$this->flash->notice('Batch name allready exists.');
return parent::redirect('batch/new', ['proxyId' => implode(',', $this->request->get('proxyId'))]);
} else {
$urlId = $this->request->get('address');
$proxyIds = $this->request->get('proxyId');
$batch = new Batch();
$batch->urlId = $urlId;
$batch->name = $name;
$batch->save();
# THE BIG KAHUNA :)
if ($this->config->application->debug) {
set_time_limit(0);
}
BatchHelper::create($this->config, $batch->id, $urlId, $proxyIds);
$this->flash->success('Batch created succesfully.');
}
} catch (\Exception $ex) {
$this->flash->error('An error occured when trying to create the new batch.');
}
$returnUrl = isset($batch) ? 'batch?batchId=' . $batch->id : 'batch';
return $this->redirect($returnUrl);
#$this->view->disable();
}