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


PHP Container::populate方法代码示例

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


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

示例1: toObject

 public function toObject($tab = array())
 {
     $o = new Container();
     $o->populate($tab);
     return $this->closures($o);
 }
开发者ID:schpill,项目名称:thin,代码行数:6,代码来源:Txtdata.php

示例2: array

<?php

namespace Thin;

/* GENERAL */
$config = array('database' => array('adapter' => 'mysql', 'host' => 'localhost', 'username' => 'root', 'password' => 'root', 'dbname' => 'ajf', 'port' => 3306, 'driver' => 'pdo_mysql', 'proxy_namespace' => 'ThinDoctrine', 'proxy_dir' => APPLICATION_PATH . DS . 'models' . DS . 'Doctrine' . DS . 'Proxies'), 'application' => array('plugins_dir' => __DIR__ . '/../../app/plugins/', 'helpers_dir' => __DIR__ . '/../../app/plugins/', 'library_dir' => __DIR__ . '/../../app/lib/', 'view' => array('cache' => true, 'cacheTtl' => 7200)), 'mailer' => array('host' => 'smtp.mandrillapp.com', 'login' => 'clementdharcourt@albumblog.com', 'password' => 'BT99CIkPBCsoWX5otYpo9g', 'port' => 587, 'secure' => null, 'auth' => true, 'debug' => false), 'mongo' => array('hostname' => 'localhost', 'replicaSet' => false, 'db' => SITE_NAME));
/* PRODUCTION ENVIRONMENT */
$production = array();
/* TESTING ENVIRONMENT */
$testing = array();
/* DEVELOPMENT ENVIRONMENT */
$development = array('application' => array('view' => array('cache' => false)));
/* LOCAL ENVIRONMENT */
$local = File::exists(__DIR__ . DS . 'local.php') ? include __DIR__ . DS . 'local.php' : array();
$config = arrayMergeRecursive($config, $local);
$application = new Container();
$configEnv = Config::get('application.env', APPLICATION_ENV);
$configEnv = ${$configEnv};
$config = arrayMergeRecursive($config, $configEnv);
return $application->populate($config);
开发者ID:noikiy,项目名称:inovi,代码行数:20,代码来源:application.php

示例3: createRow

 /**
  * Create a new row Object
  *
  * @param  string $rowId   The ID of the new row
  * @param  string $id      Unique ID of the item
  * @param  string $name    Name of the item
  * @param  int    $qty     Item qty to add to the cart
  * @param  float  $price   Price of one item
  * @param  Array  $options Array of additional options, such as 'size' or 'color'
  * @return Collection
  */
 protected function createRow($rowId, $id, $name, $qty, $price, $options)
 {
     $cart = $this->getContent();
     $newRow = new Container();
     $values = array('rowid' => $rowId, 'id' => $id, 'name' => $name, 'qty' => $qty, 'price' => $price, 'options' => new Container($options), 'subtotal' => $qty * $price);
     $newRow->populate($values);
     $cart->put($rowId, $newRow);
     return $cart;
 }
开发者ID:schpill,项目名称:thin,代码行数:20,代码来源:Cart.php

示例4: row

 public function row(array $values)
 {
     $class = $this;
     $class->results = null;
     $class->wheres = null;
     $obj = new Container();
     $save = function () use($class, $obj) {
         return $class->push($obj->assoc());
     };
     $delete = function () use($class, $obj) {
         return $class->pop($obj->getId());
     };
     $date = function ($f) use($obj) {
         return date('Y-m-d H:i:s', $obj->{$f});
     };
     $hydrate = function ($data) use($obj) {
         if (Arrays::isAssoc($data)) {
             foreach ($data as $k => $v) {
                 $obj->{$k} = $v;
             }
         }
         return $obj;
     };
     $display = function ($field) use($obj) {
         return Html\Helper::display($obj->{$field});
     };
     $tab = function () use($obj) {
         return $obj->assoc();
     };
     $asset = function ($field) use($obj) {
         return '/storage/img/' . $obj->{$field};
     };
     $obj->event('save', $save)->event('delete', $delete)->event('date', $date)->event('hydrate', $hydrate)->event('tab', $tab)->event('asset', $asset)->event('display', $display);
     return $obj->populate($values);
 }
开发者ID:schpill,项目名称:thin,代码行数:35,代码来源:Jsondb.php

示例5: row

 private function row(array $row)
 {
     $object = new Container();
     $object->populate($row);
     $db = $this;
     $save = function () use($object, $db) {
         return $db->save($object);
     };
     $delete = function () use($object, $db) {
         return strlen($object->getId()) ? $db->delete($object->getId()) : false;
     };
     $hook = function ($name, $cb) use($object, $db) {
         $object->{$name} = function () use($cb, $object, $db) {
             return call_user_func_array($cb, func_get_args());
         };
         return $object;
     };
     $object->event('save', $save)->event('delete', $delete)->event('hook', $hook);
     return $object;
 }
开发者ID:schpill,项目名称:thin,代码行数:20,代码来源:Nosql.php

示例6: store

 public static function store($flatArticle, $key = null)
 {
     $article = new Container();
     $article->populate($flatArticle);
     $serialize = serialize($article);
     if (is_null($key)) {
         $key = sha1($serialize);
     }
     $file = STORAGE_PATH . DS . 'articles' . DS . $key . '.message';
     File::delete($file);
     File::put($file, $serialize);
     return $key;
 }
开发者ID:schpill,项目名称:thin,代码行数:13,代码来源:Blog.php


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