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