当前位置: 首页>>代码示例>>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;未经允许,请勿转载。