本文整理汇总了PHP中Jam::model_name方法的典型用法代码示例。如果您正苦于以下问题:PHP Jam::model_name方法的具体用法?PHP Jam::model_name怎么用?PHP Jam::model_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jam
的用法示例。
在下文中一共展示了Jam::model_name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: test_model_name
/**
* Tests Jam::model_name().
*
* @dataProvider provider_model_name
*/
public function test_model_name($model, $expected)
{
$this->assertSame($expected, Jam::model_name($model));
}
示例3: __toString
/**
* Returns a string representation of the collection.
*
* @return string
*/
public function __toString()
{
return get_class($this) . ': ' . Jam::model_name($this->_model) . ' (' . $this->count() . ')';
}