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


PHP Mvc\Model類代碼示例

本文整理匯總了PHP中Phalcon\Mvc\Model的典型用法代碼示例。如果您正苦於以下問題:PHP Model類的具體用法?PHP Model怎麽用?PHP Model使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: getErrorMessages

 /**
  * Modelのエラーメッセージを取得
  * @return array
  */
 public function getErrorMessages()
 {
     foreach ($this->model->getMessages() as $msgs) {
         $errMsgs[] = $msgs->getMessage();
     }
     return $errMsgs;
 }
開發者ID:muramoya,項目名稱:kotori,代碼行數:11,代碼來源:BaseResources.php

示例2: showModelErrors

 public function showModelErrors(Model $model, Form $form)
 {
     foreach ($model->getMessages() as $message) {
         $fieldName = $message->getField();
         $form->addModelError($fieldName, $message->getMessage());
     }
 }
開發者ID:adiachenko,項目名稱:phstart,代碼行數:7,代碼來源:ControllerBase.php

示例3: createModelErrorMessages

 /**
  * Recebe um model e une as excessões para retornar em texto
  * 
  * @param \Phalcon\Mvc\Model $model
  * @return string
  */
 public static function createModelErrorMessages(\Phalcon\Mvc\Model $model)
 {
     $excepts = [];
     foreach ($model->getMessages() as $message) {
         $excepts[] = $message;
     }
     return implode("\n", $excepts);
 }
開發者ID:anderson-slompo,項目名稱:wsGerProj,代碼行數:14,代碼來源:PostResponse.php

示例4: databaseErrorLog

 /**
  * 數據庫操作異常
  * @param \Phalcon\Mvc\Model $model
  * @return bool
  */
 public function databaseErrorLog($model)
 {
     $error = '';
     foreach ($model->getMessages() as $msg) {
         $error .= $msg . ',';
     }
     $this->di->get('logger')->error('數據庫異常, GET:' . json_encode($_GET) . ', POST:' . json_encode($_POST) . ', error: ' . $error);
     return false;
 }
開發者ID:fu-tao,項目名稱:meelier_c,代碼行數:14,代碼來源:BaseController.php

示例5: logDatabaseError

 /**
  * 數據庫操作異常
  * @param \Phalcon\Mvc\Model $model
  */
 public function logDatabaseError($model)
 {
     if ($this->di->offsetExists('logger') == false) {
         return;
     }
     $error = '';
     foreach ($model->getMessages() as $msg) {
         $error .= $msg . ',';
     }
     $this->di->get('logger')->error('數據庫異常, GET:' . json_encode($_GET) . ', POST: ' . json_encode($_POST) . ', error: ' . $error);
 }
開發者ID:fu-tao,項目名稱:meelier_c,代碼行數:15,代碼來源:Component.php

示例6: findFirst

 public static function findFirst($parameters = NULL, $hostType = NULL)
 {
     $class = get_called_class();
     $object = new $class();
     BaseModel::$tableName = $object->getSource();
     BaseModel::$hostType = $hostType;
     return parent::findFirst($parameters);
 }
開發者ID:akashkumardce,項目名稱:phalcon,代碼行數:8,代碼來源:BaseModel.php

示例7: getMessages

 /**
  * @param bool $bAsString
  * @return \Phalcon\Mvc\Model\MessageInterface[]|string
  */
 public function getMessages($bAsString = false)
 {
     if (!$bAsString) {
         return parent::getMessages();
     } else {
         return implode(', ', parent::getMessages());
     }
 }
開發者ID:kp-favorite,項目名稱:bitfalls_utils,代碼行數:12,代碼來源:Model.php

示例8: delete

 public function delete()
 {
     foreach ($this->IgoListeValeur as $liste) {
         $liste->delete();
     }
     return parent::delete();
 }
開發者ID:nbtetreault,項目名稱:igo,代碼行數:7,代碼來源:IgoAttribut.php

示例9: getMessages

 /**
  * Replace/translate default messages generated by the ORM.
  *
  * @return array
  */
 public function getMessages()
 {
     foreach (parent::getMessages() as $message) {
         switch ($message->getType()) {
             case 'PresenceOf':
                 $message->setMessage('The field ' . $message->getField() . ' is required');
                 break;
             case 'Uniqueness':
                 $message->setMessage('The field ' . $message->getField() . ' must be unique');
                 break;
             case 'Email':
                 $message->setMessage('The field ' . $message->getField() . ' must contain a valid email');
                 break;
             case 'Url':
                 $message->setMessage('The field ' . $message->getField() . ' must contain a valid url');
                 break;
             case 'InclusionIn':
                 $message->setMessage('The field ' . $message->getField() . ' must contain a value in [' . implode(',', $message->getDomain()) . ']');
                 break;
             case 'DateValidator':
                 $message->setMessage('The field ' . $message->getField() . ' must contain a valid date.');
                 break;
             case 'TimestampValidator':
                 $message->setMessage('The field ' . $message->getField() . ' must contain a valid timestamps.');
                 break;
         }
     }
     return parent::getMessages();
 }
開發者ID:soutoner,項目名稱:api-desconecta,代碼行數:34,代碼來源:BaseModel.php

示例10: __callStatic

 public static function __callStatic($name, $parameters = null)
 {
     if (0 === strpos($name, 'has')) {
         return static::hasColumnValue(Str::convertSnake(substr($name, 3)), $parameters[0]);
     }
     return parent::__callStatic($name, $parameters);
 }
開發者ID:panlatent,項目名稱:swilab,代碼行數:7,代碼來源:Model.php

示例11: __set

 public function __set($property, $value)
 {
     if (is_object($property) || is_array($property)) {
         return parent::__set($property, $value);
     }
     $this->_dataAccess[$property] = $value;
 }
開發者ID:skullab,項目名稱:area51,代碼行數:7,代碼來源:BaseModel.php

示例12: __set

 public function __set($fieldName, $value)
 {
     // Check if the property is public
     try {
         $R = new \ReflectionClass($this);
         $property = $R->getProperty($fieldName);
     } catch (\ReflectionException $e) {
         // Property doesn't exist, call the stupid parent
         return parent::__set($fieldName, $value);
     }
     if ($property->isPublic()) {
         // Again, call your parents
         return parent::__set($fieldName, $value);
     } else {
         // Property exists, and it's private / protected
         try {
             // Maybe there is a setter for this one?
             $nameArr = explode('_', $fieldName);
             $methodName = 'set';
             foreach ($nameArr as $vv) {
                 $methodName .= ucwords($vv);
             }
             $method = $R->getMethod($methodName);
             // Okay, no exception, let's call it
             return $this->{$methodName}($value);
         } catch (\ReflectionException $up) {
             // Just let it go through
             throw $up;
         }
     }
 }
開發者ID:abc2001x,項目名稱:phalcon_mode,代碼行數:31,代碼來源:BaseModel.php

示例13: delete

 public function delete()
 {
     foreach ($this->IgoGeometrie as $geometrie) {
         $geometrie->delete();
     }
     return parent::delete();
 }
開發者ID:nbtetreault,項目名稱:igo,代碼行數:7,代碼來源:IgoClasseEntite.php

示例14: findFirst

 /**
  * Caches models data in memory
  *
  * @param mixed $parameters
  * @return $this
  */
 public static function findFirst($parameters = null)
 {
     // Create an unique key based on the parameters
     if ($key = self::createKey($parameters)) {
         $parameters['cache'] = ['key' => $key];
     }
     return parent::findFirst($parameters);
 }
開發者ID:phalcon,項目名稱:forum,代碼行數:14,代碼來源:CacheableModel.php

示例15: save

 public function save($saveMapFile = true, $data = NULL, $whiteList = NULL)
 {
     $retour = parent::save($data, $whiteList);
     if ($saveMapFile && $this->IgoCouche->IgoGeometrie->acces == "L") {
         $this->IgoCouche->save();
     }
     return $retour;
 }
開發者ID:nbtetreault,項目名稱:igo,代碼行數:8,代碼來源:IgoClasse.php


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