当前位置: 首页>>代码示例>>PHP>>正文


PHP Dept::save方法代码示例

本文整理汇总了PHP中Dept::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Dept::save方法的具体用法?PHP Dept::save怎么用?PHP Dept::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dept的用法示例。


在下文中一共展示了Dept::save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 /**
  * Simpan Departement
  * (New Departement)
  *
  * @return mixed
  */
 public function save()
 {
     $this->departement->name = Input::get('name');
     $this->departement->info = Input::get('info');
     $this->departement->uuid = uniqid('New_');
     $this->departement->createby_id = Auth::user()->id;
     $this->departement->lastupdateby_id = Auth::user()->id;
     $this->departement->created_at = new Carbon();
     $this->departement->updated_at = new Carbon();
     $saved = $this->departement->save() ? true : false;
     return Response::json(array('success' => $saved, 'results' => $this->departement->toArray()))->setCallback();
 }
开发者ID:emayk,项目名称:ics,代码行数:18,代码来源:impEloquent.php

示例2: 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->aDept !== null) {
             if ($this->aDept->isModified() || $this->aDept->isNew()) {
                 $affectedRows += $this->aDept->save($con);
             }
             $this->setDept($this->aDept);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
开发者ID:therealchiko,项目名称:getchabooks,代码行数:41,代码来源:BaseDeptMetadata.php

示例3: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Dept();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Dept'])) {
         $model->attributes = $_POST['Dept'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:anjanababu,项目名称:Asset-Management,代码行数:17,代码来源:DeptController.php

示例4: actionCreate

 public function actionCreate()
 {
     $this->hasPrivilege(Acl::ACTION_CREATE);
     $this->pageTitle = Lang::t('Add ' . $this->resourceLabel);
     $model = new Dept();
     $model_class_name = $model->getClassName();
     if (isset($_POST[$model_class_name])) {
         $model->attributes = $_POST[$model_class_name];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', Lang::t('Department saved successfully. Now create the contact person.'));
             $this->redirect(Yii::app()->createUrl('users/default/create', array('dept_id' => $model->id, Controller::GET_PARAM_RETURN_URL => $this->createUrl('view', array('id' => $model->id)))));
         }
     }
     $this->render('default/create', array('model' => $model));
 }
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:15,代码来源:DeptController.php

示例5: create

 static function create($vars, &$errors)
 {
     return Dept::save(0, $vars, $errors);
 }
开发者ID:jahanzaibbahadur,项目名称:Katak-support,代码行数:4,代码来源:class.dept.php

示例6: 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->aDept !== null) {
             if ($this->aDept->isModified() || $this->aDept->isNew()) {
                 $affectedRows += $this->aDept->save($con);
             }
             $this->setDept($this->aDept);
         }
         if ($this->isNew() || $this->isModified()) {
             // persist changes
             if ($this->isNew()) {
                 $this->doInsert($con);
             } else {
                 $this->doUpdate($con);
             }
             $affectedRows += 1;
             $this->resetModified();
         }
         if ($this->sectionsScheduledForDeletion !== null) {
             if (!$this->sectionsScheduledForDeletion->isEmpty()) {
                 SectionQuery::create()->filterByPrimaryKeys($this->sectionsScheduledForDeletion->getPrimaryKeys(false))->delete($con);
                 $this->sectionsScheduledForDeletion = null;
             }
         }
         if ($this->collSections !== null) {
             foreach ($this->collSections as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
开发者ID:therealchiko,项目名称:getchabooks,代码行数:54,代码来源:BaseCourse.php

示例7: actionAddDept

 /**
  * Handler for add new dept
  */
 public function actionAddDept()
 {
     $user = $_REQUEST['user'][0];
     $sum = $_REQUEST['sum'][0];
     $comment = $_REQUEST['comment'][0];
     $date = $_REQUEST['date'][0];
     $time = $_REQUEST['time'][0];
     $attributs = array();
     if ($user != '') {
         $attributs['user_id'] = $user;
     }
     if ($sum != '') {
         $attributs['sum'] = $sum;
     }
     if ($comment != '') {
         $attributs['comment'] = $comment;
     }
     if ($date != '' && $time != '') {
         $attributs['comment'] = $date . ' ' . $time;
     }
     if (isset($_REQUEST['id'])) {
         $id = $_REQUEST['id'];
         $attributs['id'] = $id;
     }
     $dept = new Dept($attributs);
     $dept->save();
     $id = $dept->getId();
     $this->showResponse(array('status' => true, 'id' => $id));
 }
开发者ID:crashkita,项目名称:dept,代码行数:32,代码来源:MainController.php


注:本文中的Dept::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。