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


PHP Jam::class_name方法代码示例

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


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

示例1: getMockModelArray

 public function getMockModelArray($model_name, array $params)
 {
     $items = array();
     foreach ($params as $id => $item_params) {
         $item = $this->getMockFromParams(Jam::class_name($model_name), $item_params, array($model_name))->set(array('id' => $id));
         $items[] = $item;
     }
     return $items;
 }
开发者ID:openbuildings,项目名称:shipping,代码行数:9,代码来源:Shipping.php

示例2: _resource

 private function _resource(Resource $resource, array $route_params, $is_parent = FALSE)
 {
     $resource->param($route_params);
     $output = '';
     if (isset($route_params['id'])) {
         $output = (string) $resource->object();
     } elseif ($resource->option('singular')) {
         if ($model = $resource->option('model')) {
             $output = 'Singular model: ' . Minion_CLI::color(Jam::class_name($model), 'light_red');
         }
     } else {
         $output = 'Collection of: ' . Minion_CLI::color(Jam::class_name($resource->option('model')), 'light_red');
     }
     if ($is_parent) {
         $output = 'Parent: ' . $output;
     }
     Minion_CLI::write($output);
 }
开发者ID:openbuildings,项目名称:jam-resource,代码行数:18,代码来源:Introspect.php

示例3: behavior

 /**
  * Get / Set individual behaviors.
  *
  * @param   string       $name     name of the association
  * @param   mixed        $association    the association alias or object
  * @return  Jam_Association|Jam_Meta|null
  */
 public function behavior($name, $behavior = NULL, $prepend = FALSE)
 {
     if ($behavior === NULL) {
         // Get the behavior
         return Arr::get($this->_behaviors, $name);
     }
     if ($this->_initialized) {
         // Cannot set after initialization
         throw new Kohana_Exception(':class already initialized, cannot set :behavior', array(':class' => Jam::class_name($this->_model), ':behavior' => $name));
     }
     // Set the behavior
     if ($prepend) {
         $this->_behaviors = array($name => $behavior) + $this->_behaviors;
     } else {
         $this->_behaviors[$name] = $behavior;
     }
     // Return Jam_Meta
     return $this;
 }
开发者ID:openbuildings,项目名称:jam,代码行数:26,代码来源:Meta.php

示例4: test_class_name

 /**
  * Tests Jam::class_name()
  *
  * @dataProvider provider_class_name
  */
 public function test_class_name($model, $expected)
 {
     $this->assertSame($expected, Jam::class_name($model));
 }
开发者ID:Konro1,项目名称:pms,代码行数:9,代码来源:CoreTest.php

示例5: register

 /**
  * Automatically loads a model, if it exists,
  * into the meta table.
  *
  * Models are not required to register
  * themselves; it happens automatically.
  *
  * @param   string  $model
  * @return  boolean
  */
 public static function register($model)
 {
     $class = Jam::class_name($model);
     $model = Jam::model_name($model);
     // Don't re-initialize!
     if (isset(Jam::$_models[$model])) {
         return TRUE;
     }
     // Can we find the class?
     if (class_exists($class)) {
         // Prevent accidentally trying to load ORM or Sprig models
         if (!is_subclass_of($class, 'Jam_Validated')) {
             return FALSE;
         }
     } else {
         return FALSE;
     }
     // Load it into the registry
     Jam::$_models[$model] = $meta = new Jam_Meta($model);
     // Let the intialize() method override defaults.
     call_user_func(array($class, 'initialize'), $meta);
     // Finalize the changes
     $meta->finalize($model);
     return TRUE;
 }
开发者ID:Konro1,项目名称:pms,代码行数:35,代码来源:Jam.php


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