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


PHP BaseFormDoctrine::doBind方法代碼示例

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


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

示例1: doBind

 /**
  *
  */
 protected function doBind(array $values)
 {
     $values['id'] = $this->getObject()->getId();
     // это поле всегда лишнее
     if (array_key_exists('password_repeat', $values)) {
         unset($values['password_repeat']);
     }
     // эту х-ню делать в модели
     if (isset($values['user_service_mail']) && !empty($values['user_service_mail'])) {
         $values['user_service_mail'] = $values['user_service_mail'] . '@mail.easyfinance.ru';
     }
     parent::doBind($values);
     // не обновлять e-mail если идентичен или когда не введен пароль
     if (isset($this->values['user_mail']) && !empty($this->values['user_mail']) && $this->getObject()->getUserMail() != $this->values['user_mail']) {
         if (!isset($this->values['password']) || empty($this->values['password'])) {
             unset($this->values['user_mail'], $this['user_mail'], $this->values['password']);
         }
     }
     // обновить пароль, если задан новый (и не пустой) и старый
     if (isset($this->values['password']) && !empty($this->values['password']) && isset($this->values['password_new']) && !empty($this->values['password_new'])) {
         $this->values['password'] = $this->values['password_new'];
         unset($this->values['password_new'], $this['password_new']);
         // не трогать пароль без необходимости
     } else {
         unset($this->values['password'], $this->values['password_new'], $this['password'], $this['password_new']);
     }
     return $values;
 }
開發者ID:ru-easyfinance,項目名稱:EasyFinance,代碼行數:31,代碼來源:UserProfileForm.class.php

示例2: doBind

 /**
  * Подмешивает дополнительные поля и значения:
  *     знак у суммы и прочая требуха
  * @see sfForm
  */
 protected function doBind(array $values)
 {
     // не используем поля в зависимости от типа операции
     switch ($values['type']) {
         case Operation::TYPE_BALANCE:
             unset($this['date'], $this['transfer_account_id'], $this['transfer_amount']);
             $values['accepted'] = true;
             if (!empty($values['id'])) {
                 $validator = new sfValidatorDoctrineUnique(array('model' => 'Operation', 'column' => array('account_id', 'type')), array('invalid' => sprintf('Duplicate balance operations for account %s', $values['account_id'])));
                 $validator->clean($values);
             }
             break;
         case Operation::TYPE_TRANSFER:
             unset($this['category_id']);
             break;
         default:
             unset($this['transfer_account_id'], $this['transfer_amount']);
             break;
     }
     // в зависимости от подтвержденности операции отключаем необходимости полей
     if (!$values['accepted']) {
         $this->setDraftValidation();
     }
     parent::doBind($values);
     switch ($this->values['type']) {
         case Operation::TYPE_TRANSFER:
             $this->values['amount'] = -abs($this->values['amount']);
             $this->values['transfer_amount'] = abs($this->values['transfer_amount']);
             break;
         case Operation::TYPE_EXPENSE:
             $this->values['amount'] = -abs($this->values['amount']);
             break;
         case Operation::TYPE_BALANCE:
             $this->values['comment'] = "Начальный остаток";
             break;
         default:
             $this->values['amount'] = abs($this->values['amount']);
             break;
     }
 }
開發者ID:ru-easyfinance,項目名稱:EasyFinance,代碼行數:45,代碼來源:mySyncInOperationForm.php

示例3: doBind

 protected function doBind(array $values)
 {
     parent::doBind($values);
 }
開發者ID:jdart,項目名稱:diem,代碼行數:4,代碼來源:BaseDmContactForm.class.php

示例4: doBind

 /**
  * Подмешать во входящие параметры поля, которые сможет использовать PostValidator
  * для проверки уникальности ID-операции AMT
  */
 protected function doBind(array $values)
 {
     $values['source_uid'] = Operation::SOURCE_AMT;
     $values['source_operation_uid'] = isset($values['id']) ? $values['id'] : '';
     parent::doBind($values);
 }
開發者ID:ru-easyfinance,項目名稱:EasyFinance,代碼行數:10,代碼來源:OperationImportAmtForm.php

示例5: doBind

 protected function doBind(array $values)
 {
     $values = $this->filterValuesByEmbeddedMediaForm($values, 'image_id');
     $values = $this->filterValuesByEmbeddedMediaForm($values, 'file_id');
     parent::doBind($values);
 }
開發者ID:theolymp,項目名稱:diem,代碼行數:6,代碼來源:BaseDmTestPostForm.class.php


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