本文整理汇总了PHP中CMS::orm方法的典型用法代码示例。如果您正苦于以下问题:PHP CMS::orm方法的具体用法?PHP CMS::orm怎么用?PHP CMS::orm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMS
的用法示例。
在下文中一共展示了CMS::orm方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: orm_mapper
protected function orm_mapper()
{
if (!$this->orm_name) {
return false;
}
$name = $this->orm_name;
if (is_string($name)) {
return CMS::orm()->{$name};
}
return false;
}
示例2: tie
public function tie($tags)
{
$id = (int) $this->item->id();
if ($id == 0) {
return;
}
if (!is_array($tags)) {
$tags = array($tags);
}
$items = isset($this->data['items']) ? CMS::items_for_select($this->data['items']) : false;
$table = $this->item->mapper->options['table'][0];
$table_rels = CMS_Fields_Types_Tags::table_rels($table, $this->name);
$table_tags = CMS_Fields_Types_Tags::table_tags($table, $this->name);
foreach ($tags as $tag_id) {
$tag_id = (int) $tag_id;
if ($tag_id > 0) {
if ($items && isset($items[$tag_id])) {
CMS_Fields_Types_Tags::check_tag_title($tag_id, $items[$tag_id], $table_tags);
}
CMS::orm()->connection->prepare("INSERT INTO {$table_rels} SET item_id=:item_id, tag_id=:tag_id")->bind(array('item_id' => $id, 'tag_id' => $tag_id))->execute();
}
}
}
示例3: get
public function get($var)
{
$this->deserialize($var);
$m = CMS::orm()->vars->spawn();
$m->types()->build($this->fields)->end();
$var->set_mapper($m);
return $var;
}
示例4: dbc
protected function dbc()
{
return CMS::orm()->connection();
}
示例5: process_component_config
protected function process_component_config($config_name = 'component')
{
$config = $this->config($config_name);
// TODO: split to methods
if (isset($config->admin_menu)) {
$menu = (object) $config->admin_menu;
CMS_Admin::menu($menu->caption, $menu->path, $menu->items, $menu->icon);
}
if (isset($config->templates)) {
$helpers = $config->templates['helpers'];
Templates_HTML::use_helpers($helpers);
}
if (isset($config->field_types)) {
$types = $config->field_types;
foreach ($types as $name => $class) {
CMS::field_type($name, $class);
}
}
if (isset($config->commands)) {
$commands = $config->commands;
foreach ($commands as $chapter => $data) {
$args = array_merge(array($chapter, $data['name'], $data['callback']), isset($data['args']) ? $data['args'] : array());
call_user_func_array(array('CMS', 'add_command'), $args);
}
}
if (isset($config->insertions)) {
$insertions = $config->insertions;
foreach ($insertions as $ins) {
$args = array_merge(array($ins['class']), $ins['names']);
call_user_func_array(array('CMS', 'register_insertions'), $args);
}
}
if (isset($config->events)) {
$events = $config->events;
foreach ($events as $name => $callback) {
Events::add_listener($name, $callback);
}
}
if (isset($config->orm)) {
$orm = $config->orm;
foreach ($orm as $name => $class) {
CMS::orm()->submapper($name, $class);
}
}
}
示例7: set_call_time
static function set_call_time($name)
{
CMS::orm()->connection->prepare('DELETE FROM tao_cli_calls WHERE name=:name')->bind(array('name' => $name))->execute();
CMS::orm()->connection->prepare('INSERT INTO tao_cli_calls SET name=:name, time=:time')->bind(array('name' => $name, 'time' => time()))->execute();
}