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


PHP CMS::orm方法代码示例

本文整理汇总了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;
 }
开发者ID:techart,项目名称:tao,代码行数:11,代码来源:Table.php

示例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();
         }
     }
 }
开发者ID:techart,项目名称:tao,代码行数:23,代码来源:Tags.php

示例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;
 }
开发者ID:techart,项目名称:tao,代码行数:8,代码来源:Types.php

示例4: dbc

 protected function dbc()
 {
     return CMS::orm()->connection();
 }
开发者ID:techart,项目名称:tao,代码行数:4,代码来源:Factory.php

示例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);
         }
     }
 }
开发者ID:techart,项目名称:tao,代码行数:45,代码来源:Component.php

示例6: db

 static function db()
 {
     return CMS::orm();
 }
开发者ID:techart,项目名称:tao,代码行数:4,代码来源:Base.php

示例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();
 }
开发者ID:techart,项目名称:tao,代码行数:5,代码来源:CLI.php


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