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


PHP static::hydrate方法代碼示例

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


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

示例1: fromArray

 /**
  * @param Client  $client
  * @param Project $project
  * @param array   $data
  * @return Event
  */
 public static function fromArray(Client $client, Project $project, array $data)
 {
     $event = new static($project, $client);
     if (isset($data['author_id'])) {
         $data['author'] = new User($data['author_id'], $client);
     }
     return $event->hydrate($data);
 }
開發者ID:simcyber,項目名稱:php-gitlab-api,代碼行數:14,代碼來源:Event.php

示例2: fromArray

 /**
  * @param Client  $client
  * @param Project $project
  * @param array   $data
  * @return Snippet
  */
 public static function fromArray(Client $client, Project $project, array $data)
 {
     $snippet = new static($project, $data['id'], $client);
     if (isset($data['author'])) {
         $data['author'] = User::fromArray($client, $data['author']);
     }
     return $snippet->hydrate($data);
 }
開發者ID:simcyber,項目名稱:php-gitlab-api,代碼行數:14,代碼來源:Snippet.php

示例3: fromArray

 /**
  * @param Client $client
  * @param Noteable $type
  * @param array $data
  * @return mixed
  */
 public static function fromArray(Client $client, Noteable $type, array $data)
 {
     $comment = new static($type, $client);
     if (isset($data['author'])) {
         $data['author'] = User::fromArray($client, $data['author']);
     }
     return $comment->hydrate($data);
 }
開發者ID:simcyber,項目名稱:php-gitlab-api,代碼行數:14,代碼來源:Note.php

示例4: fromArray

 /**
  * @param Client  $client
  * @param Project $project
  * @param array   $data
  * @return Branch
  */
 public static function fromArray(Client $client, Project $project, array $data)
 {
     $branch = new static($project, $data['name'], $client);
     if (isset($data['commit'])) {
         $data['commit'] = Commit::fromArray($client, $project, $data['commit']);
     }
     return $branch->hydrate($data);
 }
開發者ID:simcyber,項目名稱:php-gitlab-api,代碼行數:14,代碼來源:Branch.php

示例5: fromArray

 /**
  * @param \GitlabCI\Client $oClient
  * @param array $aData
  * @return \GitlabCI\Model\Project
  * @throws \GitlabCI\Exception\InvalidArgumentException
  */
 public static function fromArray(\GitlabCI\Client $oClient, array $aData)
 {
     if (empty($aData['id'])) {
         throw new \GitlabCI\Exception\InvalidArgumentException('Data "id" is empty');
     }
     $oProject = new static($aData['id']);
     $oProject->setClient($oClient);
     return $oProject->hydrate($aData);
 }
開發者ID:dw250100785,項目名稱:php-gitlab-ci-sdk,代碼行數:15,代碼來源:Project.php

示例6: fromArray

 /**
  * @param Client $client
  * @param array $data
  * @return Project
  */
 public static function fromArray(Client $client, array $data)
 {
     $project = new static($data['id']);
     $project->setClient($client);
     if (isset($data['owner'])) {
         $data['owner'] = User::fromArray($client, $data['owner']);
     }
     if (isset($data['namespace']) && is_array($data['namespace'])) {
         $data['namespace'] = ProjectNamespace::fromArray($client, $data['namespace']);
     }
     return $project->hydrate($data);
 }
開發者ID:simcyber,項目名稱:php-gitlab-api,代碼行數:17,代碼來源:Project.php

示例7: fromArray

 /**
  * @param Client $client
  * @param array  $data
  * @return Group
  */
 public static function fromArray(Client $client, array $data)
 {
     $group = new static($data['id'], $client);
     if (isset($data['projects'])) {
         $projects = array();
         foreach ($data['projects'] as $project) {
             $projects[] = Project::fromArray($client, $project);
         }
         $data['projects'] = $projects;
     }
     return $group->hydrate($data);
 }
開發者ID:simcyber,項目名稱:php-gitlab-api,代碼行數:17,代碼來源:Group.php

示例8: hasCustomFields

 public static function hasCustomFields($postType = null, callable $addMeta = null, callable $save = null)
 {
     $addMeta = $addMeta ?: function ($type, $wpPost) use($postType) {
         $post = new static($wpPost->ID);
         $post->hydrate();
         $post->registerFields($postType);
     };
     $save = $save ?: function ($id, $wpPost, $update) {
         $post = new static($id);
         $saved = $post->save();
     };
     // TODO use post-specific action, e.g. add_meta_boxes_post...
     add_action('add_meta_boxes', $addMeta, Plugin::ACTION_PRIORITY, $numArgs = 2);
     add_action('save_post', $save, Plugin::ACTION_PRIORITY, $numArgs = 3);
 }
開發者ID:acobster,項目名稱:wp-custom-field-traits,代碼行數:15,代碼來源:HasCustomFields.php

示例9: fromArray

 /**
  * @param Client  $client
  * @param Project $project
  * @param array   $data
  * @return Commit
  */
 public static function fromArray(Client $client, Project $project, array $data)
 {
     $commit = new static($project, $data['id'], $client);
     if (isset($data['parents'])) {
         $parents = array();
         foreach ($data['parents'] as $parent) {
             $parents[] = static::fromArray($client, $project, $parent);
         }
         $data['parents'] = $parents;
     }
     if (isset($data['author'])) {
         $data['author'] = User::fromArray($client, $data['author']);
     }
     if (isset($data['committer'])) {
         $data['committer'] = User::fromArray($client, $data['committer']);
     }
     return $commit->hydrate($data);
 }
開發者ID:simcyber,項目名稱:php-gitlab-api,代碼行數:24,代碼來源:Commit.php

示例10: fromArray

 /**
  * @param Client  $client
  * @param Project $project
  * @param array   $data
  * @return MergeRequest
  */
 public static function fromArray(Client $client, Project $project, array $data)
 {
     $mr = new static($project, $data['id'], $client);
     if (isset($data['author'])) {
         $data['author'] = User::fromArray($client, $data['author']);
     }
     if (isset($data['assignee'])) {
         $data['assignee'] = User::fromArray($client, $data['assignee']);
     }
     if (isset($data['milestone'])) {
         $data['milestone'] = Milestone::fromArray($client, $project, $data['milestone']);
     }
     if (isset($data['files'])) {
         $files = array();
         foreach ($data['files'] as $file) {
             $files[] = File::fromArray($client, $project, $file);
         }
         $data['files'] = $files;
     }
     return $mr->hydrate($data);
 }
開發者ID:simcyber,項目名稱:php-gitlab-api,代碼行數:27,代碼來源:MergeRequest.php

示例11: fromArray

 /**
  * @param Client $client
  * @param Project $project
  * @param array $data
  * @return Comparison
  */
 public static function fromArray(Client $client, Project $project, array $data)
 {
     $file = new static($project, $client);
     if (isset($data['commit'])) {
         $data['commit'] = Commit::fromArray($client, $project, $data['commit']);
     }
     if (isset($data['commits'])) {
         $commits = array();
         foreach ($data['commits'] as $commit) {
             $commits[] = Commit::fromArray($client, $project, $commit);
         }
         $data['commits'] = $commits;
     }
     if (isset($data['diffs'])) {
         $diffs = array();
         foreach ($data['diffs'] as $diff) {
             $diffs[] = Diff::fromArray($client, $project, $diff);
         }
         $data['diffs'] = $diffs;
     }
     return $file->hydrate($data);
 }
開發者ID:simcyber,項目名稱:php-gitlab-api,代碼行數:28,代碼來源:Comparison.php

示例12: findOne

 /**
  * Find one model from criteria
  *
  * @param array $where - associative array ex:
  *                     simple criteria        array('idMarque' => 1)
  *                     custom operator        array('idMarque' => array('operator' => '<=','value' => ''))
  *                     raw SQL                array('idMarque' => array('IN (5,6,4)'))
  * @param array $order - associative array ex:array('libMarque'=>'ASC')
  *
  * @return static
  */
 public static function findOne($where = array(), $order = array())
 {
     // try to fetch a model from database
     if ($dataModel = self::select(array('*'), $where, $order, 1)) {
         // hydrate new model instance with fetched data
         $model = new static();
         $model->hydrate($dataModel);
         return $model;
     } else {
         return null;
     }
 }
開發者ID:peacq,項目名稱:picorm,代碼行數:23,代碼來源:Model.php

示例13: saveAsNew

 /**
  * @param $newKey
  *
  * @return static
  */
 public function saveAsNew($newKey = null)
 {
     $new = new static();
     // hydrate new mapper with existing values
     $new->hydrate(call_user_func('get_object_vars', $this));
     // hydrate new mapper with specified keys
     $new->setId($newKey);
     // unset autoTimestamps
     if (static::useAutoTimestamp()) {
         $new->updatedAt = null;
         $new->createdAt = null;
     }
     $new->save();
     return $new;
 }
開發者ID:packaged,項目名稱:mappers,代碼行數:20,代碼來源:DoctrineMapper.php

示例14: fromArray

 /**
  * @param Client $client
  * @param array  $data
  * @return User
  */
 public static function fromArray(Client $client, array $data)
 {
     $id = isset($data['id']) ? $data['id'] : 0;
     $user = new static($id, $client);
     return $user->hydrate($data);
 }
開發者ID:simcyber,項目名稱:php-gitlab-api,代碼行數:11,代碼來源:User.php

示例15: createFromResponse

 /**
  * @param ConfigItemResponse $item
  *
  * @return static
  */
 public static function createFromResponse(ConfigItemResponse $item)
 {
     $config = new static();
     $config->hydrate($item);
     return $config;
 }
開發者ID:fortifi,項目名稱:fortifi-api,代碼行數:11,代碼來源:AbstractConfigItem.php


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