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


PHP Account::save方法代码示例

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


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

示例1: testCreateAddAndSaveAndRemoveByIndexRelatedModels

 public function testCreateAddAndSaveAndRemoveByIndexRelatedModels()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $user = UserTestHelper::createBasicUser('Billy');
     $account = new Account();
     $account->owner = $user;
     $account->name = 'Wibble Corp';
     $this->assertTrue($account->save());
     for ($i = 0; $i < self::CONTACTS; $i++) {
         $contact = ContactTestHelper::createContactByNameForOwner('sampleContact' . $i, Yii::app()->user->userModel);
         $account->contacts->add($contact);
     }
     $this->assertTrue($account->save());
     $contact = $account->contacts[0];
     $this->assertFalse($account->isModified());
     $this->assertFalse($contact->isModified());
     $this->assertTrue($account->save());
     $this->assertFalse($account->isModified());
     $this->assertFalse($contact->isModified());
     $accountId = $account->id;
     unset($account);
     $account = Account::getById($accountId);
     $this->assertEquals('Wibble Corp', $account->name);
     $this->assertEquals(self::CONTACTS, $account->contacts->count());
     $this->assertEquals("{$account->contacts->count()} records.", strval($account->contacts));
     $contact = $account->contacts[0];
     $description = $contact->description;
     $contact->description = "this is a contact";
     $this->assertTrue($account->isModified());
     $this->assertTrue($contact->isModified());
     $this->assertTrue($account->save());
     $this->assertFalse($account->isModified());
     $this->assertFalse($contact->isModified());
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:34,代码来源:RedBeanRelatedModelsTest.php

示例2: setUp

 public function setUp()
 {
     global $current_user, $currentModule;
     global $beanList;
     require 'include/modules.php';
     $current_user = SugarTestUserUtilities::createAnonymousUser();
     $unid = uniqid();
     $time = date('Y-m-d H:i:s');
     $contact = new Contact();
     $contact->id = 'c_' . $unid;
     $contact->first_name = 'testfirst';
     $contact->last_name = 'testlast';
     $contact->new_with_id = true;
     $contact->disable_custom_fields = true;
     $contact->save();
     $this->contact = $contact;
     $account = new Account();
     $account->id = 'a_' . $unid;
     $account->first_name = 'testfirst';
     $account->last_name = 'testlast';
     $account->assigned_user_id = 'SugarUser';
     $account->new_with_id = true;
     $account->disable_custom_fields = true;
     $account->save();
     $this->account = $account;
     $ac_id = 'ac_' . $unid;
     $this->ac_id = $ac_id;
     //Accounts to Contacts
     $GLOBALS['db']->query("INSERT INTO accounts_contacts (id , contact_id, account_id, date_modified, deleted) values ('{$ac_id}', '{$contact->id}', '{$account->id}', '{$time}', 0)");
     $_REQUEST['relate_id'] = $this->contact->id;
     $_REQUEST['relate_to'] = 'projects_contacts';
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:32,代码来源:Bug37123Test.php

示例3: setUp

 public function setUp()
 {
     global $current_user, $currentModule;
     $mod_strings = return_module_language($GLOBALS['current_language'], "Contacts");
     $current_user = SugarTestUserUtilities::createAnonymousUser();
     $unid = uniqid();
     $time = date('Y-m-d H:i:s');
     $contact = new Contact();
     $contact->id = 'c_' . $unid;
     $contact->first_name = 'testfirst';
     $contact->last_name = 'testlast';
     $contact->new_with_id = true;
     $contact->disable_custom_fields = true;
     $contact->save();
     $this->c = $contact;
     $account = new Account();
     $account->id = 'a_' . $unid;
     $account->first_name = 'testfirst';
     $account->last_name = 'testlast';
     $account->assigned_user_id = 'SugarUser';
     $account->new_with_id = true;
     $account->disable_custom_fields = true;
     $account->save();
     $this->a = $account;
     $ac_id = 'ac_' . $unid;
     $this->ac_id = $ac_id;
     $GLOBALS['db']->query("insert into accounts_contacts (id , contact_id, account_id, date_modified, deleted) values ('{$ac_id}', '{$contact->id}', '{$account->id}', '{$time}', 0)");
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:28,代码来源:Bug15255Test.php

示例4: action_create

 public function action_create()
 {
     if (Input::has('email') && Input::has('password') && Input::has('email2') && Input::has('password2')) {
         if (Input::get('email') == Input::get('email2') && Input::get('password') == Input::get('password2')) {
             $size = Account::where_email(Input::get('email'));
             if ($size->count() == 0) {
                 $email = Input::get('email');
                 $password = Hash::make(Input::get('password'));
                 $account = new Account();
                 $account->email = $email;
                 $account->password = $password;
                 $account->save();
                 Emailer::signUpConfirmation($email);
                 echo "Signup successful, please check your email for confirmation or login using the login bar";
                 // return Redirect::to('/');
             } else {
                 echo "That email is already registered.";
             }
         } else {
             if (Input::get('email') != Input::get('email2')) {
                 echo "Emails do not match.";
             }
             if (Input::get('password') != Input::get('password2')) {
                 echo "Passwords do not match.";
             }
         }
     } else {
         echo 'Error: Invalid input.';
     }
 }
开发者ID:angmark0309,项目名称:remarket,代码行数:30,代码来源:account.php

示例5: daftarkanCC

 function daftarkanCC()
 {
     $creditCardId = NULL;
     try {
         // If CVV2 is not required, we need to remove it. We cannot keep it empty or '' as it is considered your CVV2 is set to ''
         if (isset($_POST['user']['credit_card']['cvv2']) && trim($_POST['user']['credit_card']['cvv2']) == '') {
             unset($_POST['user']['credit_card']['cvv2']);
         }
         // User can configure credit card info later from the
         // profile page or can use paypal as his funding source.
         if (trim($_POST['user']['credit_card']['number']) != "") {
             $paypal = new PaypalWrap();
             $creditCardId = $paypal->saveCard($_POST['user']['credit_card']);
             $acc = new Account();
             $acc->getByID(Account::getMyID());
             $acc->admin_creditcardID = $creditCardId;
             $acc->load = 1;
             $acc->save();
         }
         //            $userId = addUser($_POST['user']['email'], $_POST['user']['password'], $creditCardId);
     } catch (\PayPal\Exception\PPConnectionException $ex) {
         $errorMessage = $ex->getData() != '' ? parseApiError($ex->getData()) : $ex->getMessage();
     } catch (Exception $ex) {
         $errorMessage = $ex->getMessage();
     }
     return $creditCardId;
 }
开发者ID:CapsuleCorpIndonesia,项目名称:elang-combo,代码行数:27,代码来源:PaypalWeb.php

示例6: store

 /**
  * Store a newly created account in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Account::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     // check if code exists
     $code = Input::get('code');
     $code_exists = DB::table('accounts')->where('code', '=', $code)->count();
     if ($code_exists >= 1) {
         return Redirect::back()->withErrors(array('error' => 'The GL code already exists'))->withInput();
     } else {
         $account = new Account();
         $account->category = Input::get('category');
         $account->name = Input::get('name');
         $account->code = Input::get('code');
         if (Input::get('active')) {
             $account->active = TRUE;
         } else {
             $account->active = FALSE;
         }
         $account->save();
     }
     Audit::logaudit('Accounts', 'create', 'created: ' . $account->name . ' ' . $account->code);
     return Redirect::route('accounts.index');
 }
开发者ID:kenkode,项目名称:xaraerp,代码行数:31,代码来源:AccountsController.php

示例7: actionRandomOperation

 public function actionRandomOperation()
 {
     $rec = new Account();
     $rec->amount = rand(-1000, 1000);
     $rec->save();
     echo "OK";
 }
开发者ID:moohwaan,项目名称:yii-application-cookbook-2nd-edition-code,代码行数:7,代码来源:DashboardController.php

示例8: save

 /**
  * Logs in the user using the given username and password in the model.
  * @return boolean whether login is successful
  */
 public function save()
 {
     $user = new Users();
     $user->setAttributes($this->attributes);
     $user->setAttribute("password", BaseTool::ENPWD($this->password));
     if ($user->validate() && $user->save()) {
         $accountarray = array('user_id' => Yii::app()->db->getLastInsertID(), 'total' => 0, 'use_money' => 0, 'no_use_money' => 0, 'newworth' => 0);
         $newAccount = new Account();
         $newAccount->setAttributes($accountarray);
         $newAccount->save();
         //发送邮件
         $activecode = BaseTool::getActiveMailCode($this->username);
         $message = MailTemplet::getActiveEmail($this->username, $activecode);
         $mail = Yii::app()->Smtpmail;
         $mail->SetFrom(Yii::app()->params['adminEmail']);
         $mail->Subject = "好帮贷测试邮件";
         $mail->MsgHTML($message);
         $mail->AddAddress($this->email);
         if ($mail->Send()) {
             $user->updateAll(array("regtaken" => $activecode, "regativetime" => time() + 60 * 60), "username=:username", array(":username" => $this->username));
         }
         Yii::import("application.models.form.LoginForm", true);
         $loginform = new LoginForm();
         $loginarray = array('rememberMe' => false, 'username' => $this->username, 'password' => $this->password);
         $loginform->setAttributes($loginarray);
         if ($loginform->validate() && $loginform->login()) {
         }
         return true;
     } else {
         $usererror = $user->errors;
         $this->addError("username", current(current($usererror)));
         return false;
     }
 }
开发者ID:bfyang5130,项目名称:zzl,代码行数:38,代码来源:RegeditForm.php

示例9: ActionAddAccount

 /**
  * 增加系统账户页面
  */
 public function ActionAddAccount()
 {
     $account_model = new Account();
     if (isset($_POST['Account'])) {
         // 密码要md5加密
         if (isset($_POST['Account']['PassWord']) && !empty($_POST['Account']['PassWord']) && isset($_POST['Account']['PassWord2']) && !empty($_POST['Account']['PassWord2'])) {
             $password = $_POST['Account']['PassWord'];
             $_POST['Account']['PassWord'] = md5($password);
             $_POST['Account']['PassWord2'] = md5($_POST['Account']['PassWord2']);
         }
         $account_model->attributes = $_POST['Account'];
         // 执行添加
         if ($account_model->save()) {
             // 添加操作日志 [S]
             $log = Yii::app()->user->name . '于 ' . date('Y-m-d H:i:s', time()) . ' 添加了一个名为 【' . $_POST['Account']['UserName'] . '】 的账户';
             OperationLogManage::AddOperationLog($log);
             // 添加日志
             // 添加操作日志 [E]
             // 发送通知邮件
             $email_content = '用户名:' . $_POST['Account']['UserName'] . '<br />密 码:' . $password;
             Email::sendEmail($_POST['Account']['Email'], '百城资源后台管理系统账户已开通', $email_content, 'smtp.baicheng.com', CARRENTALAPI_SENDEMAIL_USERNAME, CARRENTALAPI_SENDEMAIL_PASSWORD);
             Yii::app()->user->setFlash('save_sign', '添加成功');
             $this->redirect(Yii::app()->createUrl('Account/RestrictAccount', array('account_id' => $account_model->attributes['ID'])));
         } else {
             Yii::app()->user->setFlash('save_sign', '添加失败');
             $this->renderPartial('add_account', array('account_model' => $account_model));
         }
     } else {
         $this->renderPartial('add_account', array('account_model' => $account_model));
     }
 }
开发者ID:lovecheng,项目名称:brs-demo2,代码行数:34,代码来源:AccountController.php

示例10: testExportByModelIds

 public function testExportByModelIds()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $numberOfUserNotifications = Notification::getCountByTypeAndUser('ExportProcessCompleted', Yii::app()->user->userModel);
     $idsToExport = array();
     $account1 = new Account();
     $account1->owner = $super;
     $account1->name = 'Test Account';
     $account1->officePhone = '1234567890';
     $this->assertTrue($account1->save());
     $account2 = new Account();
     $account2->owner = $super;
     $account2->name = 'Test Account 2';
     $account2->officePhone = '1234567899';
     $this->assertTrue($account2->save());
     $idsToExport[] = $account2->id;
     $account3 = new Account();
     $account3->owner = $super;
     $account3->name = 'Test Account 3';
     $account3->officePhone = '987654321';
     $this->assertTrue($account3->save());
     $idsToExport[] = $account3->id;
     $account4 = new Account();
     $account4->owner = $super;
     $account4->name = 'Test Account 4';
     $account4->officePhone = '198765432';
     $this->assertTrue($account4->save());
     $exportItem = new ExportItem();
     $exportItem->isCompleted = 0;
     $exportItem->exportFileType = 'csv';
     $exportItem->exportFileName = 'test';
     $exportItem->modelClassName = 'Account';
     $exportItem->serializedData = serialize($idsToExport);
     $this->assertTrue($exportItem->save());
     $id = $exportItem->id;
     $exportItem->forget();
     unset($exportItem);
     $job = new ExportJob();
     $this->assertTrue($job->run());
     $exportItem = ExportItem::getById($id);
     $fileModel = $exportItem->exportFileModel;
     $this->assertEquals(1, $exportItem->isCompleted);
     $this->assertEquals('csv', $exportItem->exportFileType);
     $this->assertEquals('test', $exportItem->exportFileName);
     $this->assertTrue($fileModel instanceof ExportFileModel);
     // Get csv string via regular csv export process(directly, not in background)
     // We suppose that csv generated thisway is corrected, this function itself
     // is tested in another test.
     $data = array();
     $modelToExportAdapter = new ModelToExportAdapter($account2);
     $headerData = $modelToExportAdapter->getHeaderData();
     $data[] = $modelToExportAdapter->getData();
     $modelToExportAdapter = new ModelToExportAdapter($account3);
     $data[] = $modelToExportAdapter->getData();
     $output = ExportItemToCsvFileUtil::export($data, $headerData, 'test.csv', false);
     $this->assertEquals($output, $fileModel->fileContent->content);
     // Check if user got notification message, and if its type is ExportProcessCompleted
     $this->assertEquals($numberOfUserNotifications + 1, Notification::getCountByTypeAndUser('ExportProcessCompleted', Yii::app()->user->userModel));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:60,代码来源:ExportJobTest.php

示例11: store

 /**
  * Store a newly created resource in storage.
  * POST /debtors
  *
  * @return Response
  */
 public function store()
 {
     $contact = new Contact();
     $contact->name = Input::get('contact_person');
     $contact->email = Input::get('email');
     $contact->phone = Input::get('phone');
     $contact->mobile = Input::get('mobile');
     $contact->web = Input::get('web');
     $contact->fax = Input::get('fax');
     $contact->save();
     $contact_id = $contact->id;
     $company = new Company();
     $company->name = Input::get('company_name');
     $company->contact_id = $contact_id;
     $company->address = Input::get('address');
     $company->postal_code = Input::get('postal_code');
     $company->city = Input::get('city');
     $company->country = Input::get('country');
     $company->vat = Input::get('vat');
     $company->coc = Input::get('coc');
     $company->save();
     $company_id = $company->id;
     //Billing
     $contact_billing = new Contact();
     $contact_billing->name = Input::get('billing_contact_person');
     $contact_billing->billing = 'true';
     $contact_billing->save();
     $contact_billing_id = $contact_billing->id;
     $company_billing = new Company();
     $company_billing->name = Input::get('billing_company_name');
     $company_billing->contact_id = $contact_billing_id;
     $company_billing->address = Input::get('billing_address');
     $company_billing->postal_code = Input::get('billing_postal_code');
     $company_billing->city = Input::get('billing_city');
     $company_billing->country = Input::get('billing_country');
     $contact_billing->billing = 'true';
     $company_billing->save();
     $company_billing_id = $contact_billing->id;
     $bank = new Bank();
     $bank->name = Input::get('bank');
     $bank->bic = Input::get('bic');
     $bank->save();
     $bank_id = $bank->id;
     $account = new Account();
     $account->iban = Input::get('iban');
     $account->name = Input::get('account_name');
     $account->bank_id = $bank_id;
     $account->save();
     $account_id = $account->id;
     //Debtor Save
     $debtor = new Debtor();
     $debtor->no = Input::get('debtor_number');
     $debtor->legal = Input::get('legal');
     $debtor->company_id = $company_id;
     $debtor->billing_company_id = $company_billing_id;
     $debtor->account_id = $account_id;
     $debtor->group_id = Input::get('group');
     $debtor->save();
     return $this->index();
 }
开发者ID:BQumobile,项目名称:simple-invoicing-system,代码行数:66,代码来源:DebtorsController.php

示例12: create_temporal

 public function create_temporal()
 {
     $input = Input::All();
     $username = $input["username"];
     $domain = Config::get("constants.TEMPORAL_DOMAIN");
     $email = $username . $domain;
     $password = $input["password"];
     $passwordVerify = $input["passwordVerify"];
     $success = false;
     if (Account::where("email", "=", $email)->count() >= 1) {
         $response = "El nombre de usuario ya esta registrado.";
     } else {
         if (strcmp($password, $passwordVerify) == 0) {
             try {
                 $account = new Account(array("email" => $email, "password" => Hash::make($password), "role_id" => Config::get("constants.ACCOUNT_TYPE.TEMPORAL"), "activated" => true));
                 $account->save();
                 $success = true;
                 $response = "El usuario " . $email . " se ha creado correctamente.";
             } catch (Exception $ex) {
                 $response = "No se ha podido crear el usuario";
             }
         } else {
             $response = "Las contraseñas no coinciden.";
         }
     }
     return Response::json(array("success" => $success, "response" => $response));
 }
开发者ID:polo070770,项目名称:TFG,代码行数:27,代码来源:AccountController.php

示例13: save

    function save($returnType = RETURN_BOOLEAN)
    {
        global $dbh;
        $query = '
INSERT INTO `userDetails` (
	  `uniqueID`
	, `name`
)
VALUES (
	  "' . $this->getUniqueID() . '"
	, "' . $this->getName() . '"
)';
        switch ($returnType) {
            case RETURN_BOOLEAN:
            default:
                // return a boolean result
                $returnValue = false;
                try {
                    $dbh->beginTransaction();
                    $dbh->exec(parent::save(1));
                    $dbh->exec($query);
                    $dbh->commit();
                    $returnValue = true;
                } catch (PDOException $e) {
                    print "Error[ 101 ]: " . $e->getMessage() . "<br/>";
                    die;
                }
                break;
            case "1":
                // return the query
                $returnValue = $query;
                break;
        }
        return $returnValue;
    }
开发者ID:eebrah,项目名称:schoolsys,代码行数:35,代码来源:User.class.php

示例14: setUp

 /**
  * Create test user
  *
  */
 public function setUp()
 {
     $this->markTestIncomplete('Skipping for now while investigating');
     //setup test portal user
     $this->_setupTestUser();
     $this->_soapClient = new nusoapclient($GLOBALS['sugar_config']['site_url'] . '/soap.php', false, false, false, false, false, 600, 600);
     $this->_login();
     //setup test account
     $account = new Account();
     $account->name = 'test account for bug 39855';
     $account->assigned_user_id = 'SugarUser';
     $account->save();
     $this->_acc = $account;
     //setup test cases
     $case1 = new aCase();
     $case1->name = 'test case for bug 39855 ASDF';
     $case1->account_id = $this->_acc->id;
     $case1->status = 'New';
     $case1->save();
     $this->_case1 = $case1;
     $case2 = new aCase();
     //$account->id = 'a_'.$unid;
     $case2->name = 'test case for bug 39855 QWER';
     $case2->account_id = $this->_acc->id;
     $case2->status = 'Rejected';
     $case2->save();
     $this->_case2 = $case2;
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:32,代码来源:Bug39855Test.php

示例15: writeDefaultConfig

 public function writeDefaultConfig($config)
 {
     $account = new Account();
     $account->name = $config['name'];
     $account->workingdays = '31';
     $account->type = 'unlimited';
     $account->save();
     // add timeitem types
     $tit = new TimeItemType();
     $tit->account_id = $account->id;
     $tit->name = 'DEV';
     $tit->save();
     $tit = new TimeItemType();
     $tit->account_id = $account->id;
     $tit->name = 'ADMIN';
     $tit->default_item = true;
     $tit->save();
     $admin_settings = new Setting();
     $admin_settings->theme = 'green';
     $admin = new User();
     $admin->Account = $account;
     $admin->administrator = true;
     $admin->username = $config['username'];
     $admin->password = md5($config['password']);
     $admin->Setting = $admin_settings;
     $admin->save();
     return $account->id;
 }
开发者ID:newZinc,项目名称:timehive,代码行数:28,代码来源:AccountConfigWriter.class.php


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