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


PHP Model::findFirst方法代码示例

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


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

示例1: 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

示例2: 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

示例3: findFirstAsArray

 public static function findFirstAsArray($id, $pullDocuments = false)
 {
     $p = parent::findFirst($id);
     $p = $p->toArray();
     if ($pullDocuments) {
         $p['documents'] = Documents::findByProjectId($id);
     }
     return $p;
 }
开发者ID:romainroufast,项目名称:bilionairebikersclub,代码行数:9,代码来源:Projects.php

示例4: findFirst

 public static function findFirst($parameters = null)
 {
     if (!is_array($parameters) || !array_key_exists('cache', $parameters)) {
         if (is_array($parameters)) {
             $parameters['cache'] = array("key" => self::_createKey($parameters), "lifetime" => 3600);
         } else {
             $parameters = [$parameters, 'cache' => ["key" => self::_createKey($parameters), "lifetime" => 3600]];
         }
     }
     return parent::findFirst($parameters);
 }
开发者ID:abc2001x,项目名称:phalcon_mode,代码行数:11,代码来源:UiMenus.php

示例5: findFirstOrFail

 /**
  * FindFirst that throws an ResourceNotFoundException.
  *
  * @param  null   $parameters
  * @param  string $resource_id
  * @return Model
  * @throws ResourceNotFoundException
  */
 public static function findFirstOrFail($parameters = null, $resource_id = null)
 {
     $result = parent::findFirst($parameters);
     if ($resource_id == null) {
         $full_path = explode('\\', get_called_class());
         $resource_id = end($full_path);
     }
     if (empty($result)) {
         throw new ResourceNotFoundException($resource_id . ' Not Found');
     } else {
         return $result;
     }
 }
开发者ID:soutoner,项目名称:api-desconecta,代码行数:21,代码来源:BaseModel.php

示例6: findFirst

 /**
  * Caches models data in memory
  *
  * @param null $parameters
  *
  * @return Model
  */
 public static function findFirst($parameters = null)
 {
     $key = null;
     if (isset($parameters[0]) && isset($parameters['bind'])) {
         $key = $parameters[0] . '-' . join('-', $parameters['bind']);
     } else {
         if (isset($parameters['conditions']) && isset($parameters['bind'])) {
             $key = $parameters['conditions'] . '-' . join('-', $parameters['bind']);
         }
     }
     if ($key) {
         $key = preg_replace('/[^0-9A-Za-z]/', '-', get_called_class() . '-' . $key);
         $parameters['cache'] = array('key' => $key);
     }
     return parent::findFirst($parameters);
 }
开发者ID:atsuyim,项目名称:forum,代码行数:23,代码来源:CacheableModel.php

示例7: findFirst

 /**
  * Allows to query the first record that match the specified conditions
  *
  * @param mixed $parameters        	
  * @return Questions
  */
 public static function findFirst($parameters = null)
 {
     return parent::findFirst($parameters);
 }
开发者ID:nhannv56,项目名称:hoctap,代码行数:10,代码来源:Questions.php

示例8: findFirst

 /**
  * @return User
  */
 public static function findFirst($parameters = array())
 {
     return parent::findFirst($parameters);
 }
开发者ID:TheCodemasterZz,项目名称:PhalconUserPlugin,代码行数:7,代码来源:User.php

示例9: findFirst

 public static function findFirst($parameters = null)
 {
     $needFind = array_merge($parameters, self::$needGet);
     return parent::findFirst($needFind);
 }
开发者ID:OwLoop,项目名称:Fresh,代码行数:5,代码来源:UserView.php

示例10: findById

 /**
  * Finds record by its ID
  *
  * @param $id
  * @return \Phalcon\Mvc\Model\ResultsetInterface
  */
 public static function findById($id)
 {
     return parent::findFirst(array("conditions" => "id = ?1", "bind" => array(1 => $id)));
 }
开发者ID:arius86,项目名称:core,代码行数:10,代码来源:ModelAbstract.php

示例11: findFirst

 public static function findFirst($parameters = NULL)
 {
     $result = parent::findFirst($parameters = null);
     $_oldTags = $result->tags;
     return $result;
 }
开发者ID:devsnippet,项目名称:city_site,代码行数:6,代码来源:Posts.php

示例12: findFirst

 /**
  * Allows to query the first record that match the specified conditions
  *
  * @param array $parameters
  * @return \Engine\Mvc\Model
  */
 public static function findFirst($parameters = null)
 {
     if (!static::$_conditions) {
         return parent::findFirst($parameters);
     }
     $conditions = static::normalizeConditions(static::$_conditions);
     if (!$parameters) {
         return parent::findFirst($conditions);
     }
     if (is_string($parameters)) {
         $parameters .= " AND " . $conditions;
     } else {
         $parameters[0] .= " AND " . $conditions;
     }
     return parent::findFirst($parameters);
 }
开发者ID:tashik,项目名称:phalcon_core,代码行数:22,代码来源:Model.php

示例13: findFirst

 public static function findFirst($parameters = null, $autoCreate = false)
 {
     $parameters = self::getCacheableParams($parameters);
     return parent::findFirst($parameters, $autoCreate);
 }
开发者ID:UqiOnline,项目名称:cphalcon7,代码行数:5,代码来源:Model.php

示例14: findFirst

 public static function findFirst($parameters = null)
 {
     $parameters = self::getCacheableParams($parameters);
     return parent::findFirst($parameters);
 }
开发者ID:lisong,项目名称:cphalcon,代码行数:5,代码来源:Model.php

示例15: findFirst

 /**
  * @inheritdoc
  *
  * @access public
  * @static
  * @param array|string $parameters Query parameters
  * @return Phalcon\Mvc\Model
  */
 public static function findFirst($parameters = null)
 {
     $parameters = self::softDeleteFetch($parameters);
     return parent::findFirst($parameters);
 }
开发者ID:denners777,项目名称:api-phalcon,代码行数:13,代码来源:ModelBase.php


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