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


PHP Manager::save方法代码示例

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


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

示例1: postAction

 /**
  * @method POST
  */
 public function postAction()
 {
     /** @var Entity $entity */
     $entity = new $this->entityName();
     $this->entityMapper->mapper($entity, $_POST);
     if ($this->entityMapper->hasErrors()) {
         return $this->jsonResponse($this->entityMapper->getErrors(), 400);
     }
     $persisted = $this->manager->save($entity);
     if (!$persisted) {
         return $this->jsonResponse(array('error' => self::PERSISTED_ERROR), 400);
     }
     return $this->jsonResponse(array('success' => 'Alles Gut!'));
 }
开发者ID:karlozz157,项目名称:orm,代码行数:17,代码来源:AbstractController.php

示例2: submitNewManager

 public function submitNewManager()
 {
     if (Session::has('username') && (Session::get('user_type') == "Root" || Session::get('user_type') == "Admin")) {
         $validator = Validator::make(array("last name" => Input::get("last_name")), array("last name" => "required"));
         if ($validator->fails()) {
             Input::flash();
             return Redirect::to('settings/employees/addmanager')->with('message', $validator->messages()->first());
         } else {
             if (!empty(Input::get("first_name") && !preg_match('/^[\\pL.-\\s]+$/u', Input::get("first_name"))) || !preg_match('/^[\\pL.-\\s]+$/u', Input::get("last_name"))) {
                 Input::flash();
                 return Redirect::to('settings/employees/addmanager')->with('message', "First name/last name fields must only contain alpabetic characters and whitespaces.");
             } else {
                 $desc = "(" . Session::get('user_type') . ") " . "<strong>" . Session::get('username') . "</strong> has added a new manager: <strong>" . Input::get("first_name") . " " . Input::get("last_name") . "<br/>";
                 $manager = new Manager();
                 $manager->first_name = !empty(Input::get("first_name")) ? trim(Input::get("first_name")) : null;
                 $manager->last_name = trim(Input::get("last_name"));
                 $manager->save();
                 //Log the changes made
                 $newLog = new UserLog();
                 $newLog->description = $desc;
                 $newLog->user_id = Session::get('user_id');
                 $newLog->type = "System";
                 $newLog->save();
                 return Redirect::to('settings/employees/addmanager')->with('success', "You have successfully added a new manager.");
             }
         }
     } else {
         return Redirect::to("/");
     }
 }
开发者ID:johndavedecena,项目名称:vault,代码行数:30,代码来源:SettingsController.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 Manager();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Manager'])) {
         $model->attributes = $_POST['Manager'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->username));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:BGCX261,项目名称:zoomtyre-svn-to-git,代码行数:17,代码来源:ManagersController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ["txtName" => "required|unique:teams,name", 'staff' => 'required'], ["txtName.required" => "Please enter cate's name.", 'txt.unique' => 'This name has already been taken', 'staff.required' => 'Please select staff']);
     $team = new Manager();
     $team->name = $request->txtName;
     $team->created_user_id = Auth::user()->id;
     $team->save();
     foreach ($request->input('staff') as $key => $value) {
         $detail = new TeamDetail();
         $detail->team_id = $team->id;
         $detail->staff_id = $value;
         $detail->save();
     }
     return redirect()->route('admin.team.manager.index')->with('success', 'Posted completely!');
 }
开发者ID:trongtri0705,项目名称:staff,代码行数:21,代码来源:TeamController.php

示例5: actionCreate

 public function actionCreate()
 {
     if (Yii::app()->user->getIsSuperUser() == false && Yii::app()->user->checkAccess('createManager') == false) {
         throw new CHttpException(403);
     }
     $manager = new Manager();
     if (isset($_POST['Manager'])) {
         $manager->attributes = Yii::app()->request->getPost('Manager');
         if ($manager->validate() && $manager->save()) {
             $this->setFlashMessage('管理员添加成功');
             ManagerLog::logCurrentUserAction(1, '添加管理员', $manager->login_name);
             $this->redirect($this->getReturnUrl());
         }
     }
     $managerRoleOptions = ManagerRole::model()->getOptions();
     $this->breadcrumbs = array('管理员' => array('index'), '添加');
     $this->render('create', array('manager' => $manager, 'managerRoleOptions' => $managerRoleOptions, 'returnUrl' => $this->getReturnUrl()));
 }
开发者ID:kinghinds,项目名称:kingtest2,代码行数:18,代码来源:ManagerController.php

示例6: self

    /**
     * Self Referencing
     */
    function self_referencing()
    {
        echo '<h1>Self Referencing Relationships</h1>';
        echo '<p>DataMapper allows you to have a model setup with a relationship to its self (hence, self referencing).</p>';
        echo '<p>Take a look at the Employee, Manager, Supervisor, and Underling models included in the DataMapper download.  You\'ll notice they all have references back to the employees table (with their inheritance of the Employee model). The relationships they\'re setup with are:</p>';
        echo '<ul><li>A Manager manages Many Supervisors.</li><li>A Supervisor has One Manager.</li><li>A Supervisor supervises Many Underlings.</li><li>An Underling has One Supervisor.</li></ul>';
        echo '<hr />';
        echo '<p>Here we create a number of different types of employees.</p>';
        echo '<code>
		// Create Manager<br />
		$m = new Manager();<br />
		$m->first_name = \'Jake\';<br />
		$m->last_name = \'Ronalds\';<br />
		$m->position = \'Manager\';<br />
		$m->save();<br />
		<br />
		<br />
		// Create Supervisors<br />
		$s = new Supervisor();<br />
		$s->first_name = \'Bob\';<br />
		$s->last_name = \'Thomas\';<br />
		$s->position = \'Supervisor\';<br />
		$s->save();<br />
		<br />
		$s = new Supervisor();<br />
		$s->first_name = \'Sarah\';<br />
		$s->last_name = \'Parker\';<br />
		$s->position = \'Supervisor\';<br />
		$s->save();<br />
		<br />
		<br />
		// Create Underlings<br />
		$u = new Underling();<br />
		$u->first_name = \'Fred\';<br />
		$u->last_name = \'Smith\';<br />
		$u->position = \'Underling\';<br />
		$u->save();<br />
		<br />
		$u = new Underling();<br />
		$u->first_name = \'Jayne\';<br />
		$u->last_name = \'Doe\';<br />
		$u->position = \'Underling\';<br />
		$u->save();<br />
		<br />
		$u = new Underling();<br />
		$u->first_name = \'Joe\';<br />
		$u->last_name = \'Public\';<br />
		$u->position = \'Underling\';<br />
		$u->save();<br />
		<br />
		$u = new Underling();<br />
		$u->first_name = \'Sam\';<br />
		$u->last_name = \'Rogers\';<br />
		$u->position = \'Underling\';<br />
		$u->save();</code>';
        // Create Manager
        $m = new Manager();
        $m->first_name = 'Jake';
        $m->last_name = 'Ronalds';
        $m->position = 'Manager';
        $m->save();
        // Create Supervisors
        $s = new Supervisor();
        $s->first_name = 'Bob';
        $s->last_name = 'Thomas';
        $s->position = 'Supervisor';
        $s->save();
        $s = new Supervisor();
        $s->first_name = 'Sarah';
        $s->last_name = 'Parker';
        $s->position = 'Supervisor';
        $s->save();
        // Create Underlings
        $u = new Underling();
        $u->first_name = 'Fred';
        $u->last_name = 'Smith';
        $u->position = 'Underling';
        $u->save();
        $u = new Underling();
        $u->first_name = 'Jayne';
        $u->last_name = 'Doe';
        $u->position = 'Underling';
        $u->save();
        $u = new Underling();
        $u->first_name = 'Joe';
        $u->last_name = 'Public';
        $u->position = 'Underling';
        $u->save();
        $u = new Underling();
        $u->first_name = 'Sam';
        $u->last_name = 'Rogers';
        $u->position = 'Underling';
        $u->save();
        echo '<hr />';
        echo '<p>Now we\'ll set up some relationships.</p>';
        echo '<code>// Get the first Supervisor<br />
		$s = new Supervisor();<br />
//.........这里部分代码省略.........
开发者ID:brenden,项目名称:Ignited-Blog,代码行数:101,代码来源:examples.php

示例7: readline_leader

 public function readline_leader($sheet, $project_id, $i)
 {
     $interviewer = new Manager();
     $interviewer->name = self::filter($sheet->getCell('C' . $i)->getValue());
     $interviewer->username = random_string();
     $interviewer->password = random_string();
     $interviewer->role = 'L';
     if (!$interviewer->save()) {
         foreach ($interviewer->getMessages() as $message) {
             throw new Exception($message);
         }
     }
 }
开发者ID:Brucewyh,项目名称:Questionnaire,代码行数:13,代码来源:ExcelLoader.php

示例8: insertInterviewer

 public static function insertInterviewer($data, $project_id)
 {
     //对原有数据整理
     $interviewer = Manager::find(array('project_id =?0 and role=?1', "order" => "username desc", 'bind' => array(0 => $project_id, 1 => 'I')));
     $new_count = count($data);
     //1501 101
     $already_number = 0;
     if (count($interviewer) == 0) {
         $already_number = 0;
     } else {
         $already_number = $interviewer[0]->username - $project_id * 1000 - 100;
     }
     #异常
     if ($new_count + $already_number > 99) {
         throw new Exception('项目人数超限-99');
     }
     $start = $project_id * 1000 + 100 + $already_number + 1;
     try {
         $manager = new TxManager();
         $transaction = $manager->get();
         foreach ($data as $value) {
             $manager = new Manager();
             $manager->setTransaction($transaction);
             $manager->project_id = $project_id;
             $manager->role = "I";
             $manager->username = $start++;
             $manager->password = self::getRandString();
             $manager->name = $value;
             if ($manager->save() == false) {
                 $transaction->rollback("数据插入失败");
             }
         }
         $transaction->commit();
         return true;
     } catch (TxFailed $e) {
         throw new Exception($e->getMessage());
     }
 }
开发者ID:sunxfancy,项目名称:Questionnaire,代码行数:38,代码来源:PmDB.php


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