當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。